I'm trying to make my Python command-line app as self-installing as possible for some Mac users in my company by registering it as a "command-line accessible tool" using setup.py
as described here.
My project tree (simplified) looks like so:
my-app
|-app.py
|-setup.py
Building off Kenneth Reitz's example, here's my setup.py script:
setup(
name=my-app,
...
packages=find_packages(exclude=('tests',)),
# For entry point. Based on https://stackoverflow.com/a/28471597/9381758.
py_modules=['app'],
# Based on https://stackoverflow.com/a/11717581/9381758.
entry_points={
'console_scripts': ['my-app = app:main']
}
)
When I run python setup.py install
, it installs to my pyenv directory:
~/.pyenv/versions/3.6.4/bin/my-app
This works:
$ ~/.pyenv/versions/3.6.4/bin/my-app -h
usage: my-app [-h]
This doesn't:
$ my-app -h
-bash: my-app: command not found
Is there an elegant way to update my setup.py
script so that after install end-users will be able to run the my-app
command without further tweaks or including the full path?