Using package entry points with pyproject.toml based editable installs

Viewed 827

My entry points are setup like this

[options]
package_dir =
    = package
packages = .
python_requires = >=3.6

[option.entry_points]
console_scripts =
    cons = scripts.cons

gui_scripts =
    gui = scripts.gui

I installed the package in editable mode with pip install -e .. I can import package through a Python REPL, but running cons or gui (these are not the real names) doesn't work. I found that the entry point scripts are indeed not placed in %LOCALAPPDATA%\Programs\Python\Python39\Scripts but %LOCALAPPDATA%\Programs\Python\Python39\Lib\site-packages\package.egg-link does exist

1 Answers

When using setuptools, this is because you installed the package in editable mode, and then tried to run it from the CLI. To use the command from the CLI, you may NOT install it in editable mode. Instead just use:

pip install .

Using flit allows for editable CLI installs.

Related