1

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.

EDIT

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

red888
  • 27,709
  • 55
  • 204
  • 392
  • `pip show --files mycli` — where is `mycli` script? – phd Oct 05 '22 at 21:24
  • Updated my post with an edit. I appears to return a path that does not exist. – red888 Oct 05 '22 at 21:37
  • 1
    The path shown `../../../bin/mycli` is not related to the current directory, it's related to the directory in `Location:` header (higher up in the output). Check if the directory (Location + …/bin/) exists, check if there is `mycli` script in it, check the directory is in `$PATH`. – phd Oct 05 '22 at 22:04
  • Thanks I see whats happening now! – red888 Oct 06 '22 at 14:02
  • 1
    @phd could you add you tips as an answer? I googled around and had trouble figuring out what was happening. I think other users would benefit from the info shared. – red888 Oct 06 '22 at 14:08

1 Answers1

1

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.

phd
  • 82,685
  • 13
  • 120
  • 165