Skip to main content

Python Template 🐍

PyPI version

A template for a python project for 2025

Features:

  • 🛠️ configuration in a single file pyproject.toml
  • 📦 uv as package manager
  • 💅 ruff for linting and formatting
  • 🧪 pytest
  • 🧹 Makefile with 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 pypi on push on main
    • auto creating a new tag on push on main, sync versions
    • run tests and lint on dev and main when a PR is open

Getting started

Installation

To set it up and run

uv sync

Then

python main.py

Will 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_laugh

Linting

ruff check

Formatting

ruff format

CI/CD

Tests

Tests inside /tests are run using pytest on PR both on dev and main

Publish Package

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"

Docker

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

Release files for python-template-zuppif 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-template-zuppif 0.1.3
File Size Uploaded
python_template_zuppif-0.1.3.tar.gz 14.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-template-zuppif 0.1.3
File Interpreter ABI Platform
python_template_zuppif-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 18.4 kB

Release files / python_template_zuppif-0.1.3.tar.gz

Download URL python_template_zuppif-0.1.3.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e1e7eca7662c1340bc269da6c4901e10fea9fb0a1233173ec9b6dc71e65a8266
BLAKE2b-256 checksum
How to use checksums
9719e0ea07e2ce08cdefe64b3f5f367ff648014297f951ae951b3115a71d74bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 31, 2024.

Transparency log

Release files / python_template_zuppif-0.1.3-py3-none-any.whl

Download URL python_template_zuppif-0.1.3-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e71577d8a5ca8aa069f7bed8c6b5459fb8c8d6552bd225714e1fe3377ec67df
BLAKE2b-256 checksum
How to use checksums
3da78adf9175114e334e7523172aefc2b7ca174d822c7098849f215b43225274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.0.1 CPython/3.12.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 31, 2024.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page