this is my (Bertold) project template for python using flit as build and packaging tool.
The idea is to build a template with sensible defaults, that can nicely be used as is. Things can easily be added or removed as needed!
Some options will be asked from cookiecutter and maybe something is available as template to look at, but not active
to bootstrap the python venv after initializing the cookiecutter, just run make install maybe there will be an optional cookiecutter hook for that!
It uses these development tools
I follow the 'src - layout' as detailed here TLDR: your tests are not testing your setup but the one an install would look like
a pyproject.toml file as the means to configure everything possible. No setup.py or setup.cfg
flit as build and packaging tool because its easy and painless to use
pip-tools to pin version numbers and get dependency inheritance
bumpver for bumping versions, it supports both semver and calver set up:
- semver
- commit, tag
pytest as the testing framework
mypy for static type analysis
isort to automatically align the imports
black as the autoformatter
- line length 120
ruff as linter with some settings:
- line length 120
- ignore unused imports (F401) in init.py
invoke for some helpful tasks as:
- test - run test suite
- clean - delete all temporary files
- code-quality - check, only boolean
- lint - run linter and get analytics
- format - autoformat with black and isort
- build
- publish
- bump [major, minor, patch] version, autocreate commit and tag
- compile requirements files
Makefile for convenience whats not possible in invoke?
- bootstrap project
- create venv
- delete distclean (delete all data and venv)
- run invoke tasks with venv
for simplicity the venv will be created in folder .venv - any other things need adaption! (e.g. using virtualenvwrapper)
gitlab-ci some gitlab ci pipelines for
- running code-quality
- running tests
- build & publish
pre-commit for some git hooks, comes pre-configured with some helpful ones but needs to be installed locally
to maybe be done in some later versions!
sphinx for documentation - maybe not
asdf a .tools-versions
file with specific versions for that project
maybe alternatively also
direnv for folder specific settings
pypirc or publish options, also 2 registries, azure and gitlab