A nice starting point for a modern python project.
This template is licensed under the MIT-0 license, meaning you're basically free to do whatever you want with it.
You need to have Python 3 installed (obviously), the exact version is configurable in pyproject.toml but defaults to 3.9+
You also need to have Poetry installed, check the readme for instructions. Note though that some Linux distributions have a Poetry package available in which case you might want to install that instead.
- Arch Linux (and derivatives): python-poetry
- OpenSuse Tumbleweed: python310-poetry, python39-poetry, python38-poetry
- Fedora: python3-poetry
- Debian (Sid): python3-poetry
Poetry is a packaging and dependency manager for Python.
Ruff is an extremely fast Python linter written in Rust.
Black is an uncompromising code formatter for Python. It's designed to format code in a fashion that reduces merge conflicts.
isort "isort your imports, so you don't have to."
pytest Is the most popular testing framework for Python that isn't unittest. It integrates well with unittest and adds on a lot of powerful features for testing.
Make is used for scripting the various tooling to make them easy to execute. The Makefile contains targets for each tooling as well as an init target for initialising the project and a ci target suitable for running in a CI pipeline.
make init
installs all projects using poetry
make format
runs Black and isort on src/ and tests/ to reformat all files and order imports.
make lint
runs flake8 on src/ and tests/ and reports any linting errors, fails if there are any linting errors and
succeeds otherwise.
make stylecheck
runs Black in check mode, reporting any changes that would be made instead of making them. Fails if any
change would be made and succeeds if no changes would be made
make typecheck
runs mypy on src/ and reports any type errors, fails if there is any type errors and succeeds otherwise.
make test
runs all tests in tests/ using PyTest, fails if there is any test failures and suceeds otherwise.
make ci
is a meta target that depends on stylecheck, lint, typecheck and test and fails if any of those targets fails.
The templates comes pre-baked with CI support for both GitLab and GitHub. It contains one job that runs on pull requests and that runs the ci Make target.