I strongly recommend the following resources for more details on this process:
- The Python Packaging User Guide
- The Hitchhiker's Guide to Python
- Mahmoud Hashemi's "Python Packaging Gradient" Talk
Level 0: Ugly scripts
We all start making scripts like this. Basically, taking command entered in the python REPL, and saving them to a file.
Level 1: Modules
Level up to writing pretty scripts that can be imported as modules.
Level 2: Multi-File Modules
Adding an __init__.py
file allows for the creation of hierarchical modules.
Level 3: Local Installation
We can then install these modules locally by introducing a setup.py
file and running pip install -e .
.
Use python's setuptools to turn your module into an acutal installable artifact: python setup.py sdist
twine upload --repository-url https://test.pypi.org/legacy/ dist/*