- Published on
Python Golden Template
- Authors
- Name
- Chris Ostrouchov
- @costrouc
Creating a python package with all of the best practices can be daunting. I myself have spent a lot of time trying to figure this out so I decided to make a template with the goal of showing myself how to add each "feature" to my project. This post will be a brief overview of all the steps. Detailed documentation is on the readthedocs page associated with the template features include:
- python packaging with
setup.py
,README.md
,CHANGELOG.md
- deploying to pypi with
twine
and continuous delivery with Gitlab - deploying to conda with
conda
and continuous delivery with Gitlab - creating docker containters and continuous delivery to gitlab registries and docker hub
- testing and code coverage on every commit with Gitlab and
pytest
- documenting a package with readthedocs and gitlab pages and a custom domain
- command line interface with argparse
- badges to decorate your README.md
The excellent python packages used:
- pytest for testing
- pytest-cov for test coverage
- twine for pypi package deployment
- conda for anaconda package deployment
- sphinx for documentation
- sphinx_rtd_theme for the excellent readthedocs css theme
- argparse the awesome cli tool from the standard library
Non-python tools used (all open-source):
- gitlab.com for a package repository (similar to Github)
- readthedocs.org for hosting package documentation
- dockerhub for hosting public docker containers
- shields.io for some badges that are not provided by services
- pypi.org for python package repository
- anaconda.org for python conda package repository
Other than that everything is in the standard library! Python best practices are still confusing. Compiling all of these steps took me about a day of time to get just right even after I have already done it before.
If there are any more python best practices that should be added to the template please let me know!