I had this in my setup.py:
from setuptools import setup, find_packages
setup(
name="mycli",
packages=find_packages(),
entry_points={
"console_scripts": [
"mycli = myproject.main:program.run"
]
},
)
After installing my package with pip I was able to run mycli
from the shell and it executed my python app.
But I'm switching to setup.cfg.
My setup.py now looks like this:
from setuptools import setup
setup()
And my setup.cfg has this in it:
[options.entry_points]
console_scripts =
mycli = myproject.main:program.run
When installing it locally with pip mycli cannot be found. From what I have read my setup.cfg is correctly configured. Is there something I am missing that is causing the setup.cfg config to not create the entry point correctly?
After installing if I run pip show --verbose mycli
I see the correct entrypoints in the configuration.
Per the comments if I run pip show --files mycli | grep mycli
I see this:
Location: /Users/me/.pyenv/versions/3.10.0/lib/python3.10/site-packages
../../../bin/mycli
I am able to run ./Users/me/.pyenv/versions/3.10.0/bin/mycli
Looks like I was just missing some path settings with my pyenv setup probably not related to setup.cfg at all. Looks like this issue: Interpreters installed via pyenv are not added to $PATH
To find out where pip
installs files run pip show --files mycli
. First note "Location:" header or extract it separately:
pip show --files mycli | grep -F Location:
The header provides the base directory (like "$HOME"/.local/lib/python2.7/site-packages/
). Note the relative path to the script(s). In your case it's ../../../bin/mycli
, so the absolute path should be something like "$HOME"/.local/bin/
.
Check if the directory exists, check if there is mycli
script in it, check the bin
directory is in $PATH
.