one_file.py
contains some general functions, classes, and a main()
.
I'd like to make it pip
installable with a command line script that calls the main()
function.
What's a directory structure and setup.py
that will do this?
one_file.py
contains some general functions, classes, and a main()
.
I'd like to make it pip
installable with a command line script that calls the main()
function.
What's a directory structure and setup.py
that will do this?
You can get away with this with just a setup.py
and your module--no additional directories. In your setup.py
just use setup(..., py_modules=['one_file'], ...)
(you might want to check on the exact spelling). To install the script you can use the console_scripts
entry-point:
from setuptools import setup
setup(
name='one-file',
version='1.0',
py_modules=['one_file'],
entry_points={'console_scripts': ['one-file = one_file:main']}
)