A template for a python project for 2025
Features:
- 🛠️ configuration in a single file
pyproject.toml - 📦
uvas package manager - 💅
rufffor linting and formatting - 🧪
pytest - 🧹
Makefilewith code quality checks - 📚 auto doc generation
- 🐳 CI/CD Optimized Docker Image runs when a new release is created pushing to gh registry
- 🦾 GitHub actions:
- auto publish to
pypion push onmain - auto creating a new tag on push on
main, sync versions - run
testsandlintondevandmainwhen a PR is open
- auto publish to
To set it up and run
uv syncThen
python main.pyWill output a random joke
Why did the cow in the pasture get promoted at work? ... Because he is OUT-STANDING in his field!
You can now run, for example, a function defined as scripts in the pyproject.toml
make_me_laughruff check
ruff format
Tests inside /tests are run using pytest on PR both on dev and main
In order to publish to pypi you need to create a publisher on pypi.
This is explained here and here
In practice go your pypi project -> Manage Project -> Publishing, scroll and "add a new publisher"
Dockerfile contains a multi stage build that uses --compile-bytecode to compite your package. For this example, the resulting image is just
docker build -t python-template .REPOSITORY TAG IMAGE ID CREATED SIZE
python-template latest 1ded7d260b1c 58 seconds ago 55.4MB
The image is build using the build workflow when a new release is created