Command line scripts inside python packages are common. You can organise your package in such a way that when a user installs the package, the script will be available on their path.
If you had the
greetings package which had the command line script
greetings/ greetings/ __init__.py hello_world.py
You could run that script by running:
However if you would like to run it like so:
You can achieve this by adding
scripts to your
setup.py like this:
from setuptools import setup setup( name='greetings', scripts=['hello_world.py'] )
When you install the greetings package now,
hello_world.py will be added to your path.
Another possibility would be to add an entry point:
This way you just have to run it like: