A best-practices template project for Python modules
- Create a new repository using this template.
- Make sure that
python
is installed and available on system path. I strongly recommend usingpyenv
. Python 2 is not supported. It's end of life was on January 1st, 2020. - Make sure
poetry
is installed. This usually just meanspython -m pip install poetry
. - Rename the project using the provided script:
./rename_template.sh
. - Run
make
to initialize the project configuration and build everything. - Refer to the Makefile to learn about the various operations available. Most of them are just facades for
poetry
.
- Basic project/module organization according to https://packaging.python.org
- Makefile bootstrapping script
- poetry with virtual environments and project builds
- black code formatting
- Unit testing with pytest
- Linting (flake8) and code formatting (autopep8) support
- isort support for automated import sorting
- mpyp support for type checking
- Publishing to PyPi.org
- vscode editor configuration including plugin recommendations, debugging support, unit test discovery and on-save formatting
- Github actions continuous integration with multi-python testing
- Executable script so after package installation you can run from the CLI using
my_module_cli
- http://packaging.python.org/
- https://packaging.python.org/en/latest/distributing.html
- https://pypi.org/
- https://github.com/pypa/sampleproject
- https://www.python.org/dev/peps/
- https://www.python.org/dev/peps/pep-0008/
- https://www.kennethreitz.org/essays/why-you-should-use-vs-code-if-youre-a-python-developer
- https://code.visualstudio.com/docs/python/python-tutorial
- Embed flake8 config into
pyproject.toml
once they support it (see) - Use cookiecutter instead of shell script (it does work fine at the moment though)
This project is licensed under Apache License 2.0.