Search code examples
pythonpackagevirtualenvsetuptoolsentry-point

Python entry_point in virtual environment not working


I have a virtual environment where I am developing a Python package. The folder tree is the following:

working-folder
|-setup.py
|-src
  |-my_package
    |-__init__.py
    |-my_subpackage
      |-__init__.py
      |-main.py

main.py contains a function my_main that ideally, I would want to run as a bash command.

I am using setuptools and the setup function contains the following line of code

setup(
...
    entry_point={
        "console_scripts": [
            "my-command = src.my_package.my_subpackage.main:my_main",
        ]
    },
...
)

When I run pip install . the package gets correctly installed in the virtual environment. However, when running my-command on the shell, the command does not exist.

Am I missing some configuration to correctly generate the entry point?


Solution

  • I simply mistyped the argument entry_point, which actually is entry_points. Unfortunately, I was not getting any output errors.