0

i have the following project structure

my_project
|- src
   |- __init__.py
   |- cli.py
|- setup.py

cli.py just provides a "Hello World" function:

def main():
  print("Hello World")

and this is my setup.py

from setuptools import setup

setup(
    name="my_project",
    version="0.0.1",
    package_dir={"": "src"},
    entry_points={
        "console_scripts": [
            "my-test=cli:main"
        ]
    }
)

Now I build a package of that project via python3 setup.py sdist and then install that package simply via pip into my active venv. Now I assume when I just execute my-test from the command line the "hello world" function should run. But it seems like corresponding script is not generated properly since I receive the following error:

from cli import main
ModuleNotFoundError: No module named 'cli'

It seems like it is not resolving the main package correctly. Any hint what my mistake with this setup is?

Sebastian Dine
  • 505
  • 4
  • 15

0 Answers0