Like this Python official doc about packaging to PYPI explains, you can use the build package for this.
For this you do need some setup. The documentation will give you a basic project structure setup. Then add the following line to your setup.py
or setup.cfg
file. I formatted it for the setup.py version of the file as i prefer that option.
entry_points = {
'console_scripts': ['YOUR_CLI_NAME=YOUR_SRC_FILE:YOUR_MAIN_FUNCTION']
},
The above code will configure your program to work when running YOUR_CLI_NAME
in the command line.
You only need to package the program for PIP and install it.
python -m pip install --upgrade build
python -m build
This will create a dist
directory and build your install files. You can install it using
pip install your_wheel_file.whl
Optionally you can also upload to the PYPI archive.
I hope this helps you, please refer to the documentation i linked above for any further information. It's all in there!