Modern Python package template
A Copier template for modern Python projects.
Canonical example repo generated from this template: mgaitan/yet-another-demo
Documentation: https://mgaitan.github.io/python-package-copier-template/
Features
- 🐍 Modern Python package (3.12+)
- 📦 Build and dependency management with uv, split by groups (dev/qa/docs)
- 🧊 Dependency cooldowns enabled by default in
uv([tool.uv].exclude-newer = "1 week"), with targeted overrides when needed (for examplety) to reduce supply-chain risk without blocking QA tools - 🛡️ uv malware checks enabled in Make targets and GitHub Actions to reject locked dependencies with known malicious-package advisories
- 🧹 Linting and formatting via Ruff with a broad set of rules enabled
- ✅ Type checking via ty
- 🪝 Optional pre-commit style QA orchestration via prek as an external tool (
uv tool install prek; hooks includecheck-ast,check-yaml,check-toml, Ruff, Ty) - 🧪 Tests with pytest, coverage.py and extensions
- 📚 Docs with Sphinx, MyST and a few extensions, deployed to GitHub Pages
- 👀 Automatic docs preview deployment for PRs that modify documentation (
/_preview/pr-<PR_NUMBER>/on GitHub Pages) - 🧭 Generated docs follow Diataxis and document rationale in
about_the_docs - 🏗️ Use of GitHub CLI for autotic project creation
- ⚙️ CI workflow on GitHub Actions
- 🚀 Automated releases to PyPI via Trusted Publishing
- 🧠 Sensible defaults via introspection to minimize answers during the initial setup
- 🛠️ Makefile with shortcuts for common tasks
- 📄 Generation of generic docs such as
CODE_OF_CONDUCT, plus an optionalLICENSE - 🤖 Heavily curated AGENTS.md
- 🌀 Initial setup of the development environment and git repo
- 🔁 Scheduled template refresh workflow that opens a PR every 20 days when updates are available
- ♻️ Projects updatable with
copier update
[!NOTE] Sister project for Django internal management systems: mgaitan/django-unfold-copier-template.
Please read my blog post to learn about the details of the decisions I made and the alternatives I considered.
Quick setup and usage
Quick shortcut (auto-detects copy vs update):
uvx python-package-copier-template [PATH_TO_PROJECT]
This runs copier copy --defaults --unsafe to PATH_TO_PROJECT (or . if omitted) when no .copier-answers.yml is present, or copier update --defaults --unsafe when it is.
Check the installed version with uvx python-package-copier-template --version.
When installed from PyPI, the wrapper copies from the matching template release instead of always using main.
If you want the latest development version straight from this repository instead of the latest published release, use:
uvx git+https://github.com/mgaitan/python-package-copier-template [PATH_TO_PROJECT]
You can check that wrapper version with uvx git+https://github.com/mgaitan/python-package-copier-template -- --version.
Start a new project explicitly with Copier if you want to bypass the wrapper:
uvx --with=copier-template-extensions copier copy --trust "gh:mgaitan/python-package-copier-template" /path/to/your/new/project
To upgrade an existing project created from this template to the latest version, run:
uvx --with=copier-template-extensions copier update . --trust
This fetches the latest template version and guides you through updating your project.
Existing README.md and docs/** files are left untouched so project-specific
documentation is not replaced. New documentation files are still added when the
template introduces them; adopt later changes to existing pages manually from the
template diff when they are relevant to your project.
The generated project also ships a Template Update GitHub Actions workflow that runs every 20 days (or on manual dispatch) to execute uvx copier update --trust --defaults . and open a pull request with the changes and template version bump.
To test a local development version of the template, clone the repository and run:
uv sync
uv run copier copy --trust --vcs-ref=HEAD . /path/to/your/test/project
If you create the GitHub repository via the gh CLI prompt, the template will
attempt to enable immutable releases and GitHub Pages (using the Actions build
type). Immutability protects assets and tags for future releases. If Pages is
unavailable (for example, with some private repositories or account policies),
the docs workflow will keep failing until Pages is allowed.
To publish a release of your project to PyPI, you need to register the project with trusted publishing. Read more about how this workflow works here.
This repository's own release workflow also refreshes the demo repository after a successful publish. That step requires the DEMO_REPO_TOKEN GitHub Actions secret, documented in Configuration.
Then
$ make bump # optional
$ make release
Acknowledgement
This project template started as a fork of pawamoy/copier-uv. Then I simplified and changed it to fit my needs.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file python_package_copier_template-0.6.0.tar.gz.
File metadata
- Download URL: python_package_copier_template-0.6.0.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
186cbb47aee480dfcd74daff3dfa07320e7a20a36cdfaabd45da81be9ef38e5e
|
|
| MD5 |
18236d0bc3df7bb002aea73e32ed990c
|
|
| BLAKE2b-256 |
7bbe9a8261564242d45c669d06fd26b6518ff693982f1fab29da80c5b315d7c7
|
Provenance
The following attestation bundles were made for python_package_copier_template-0.6.0.tar.gz:
Publisher:
cd.yml on mgaitan/python-package-copier-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_package_copier_template-0.6.0.tar.gz -
Subject digest:
186cbb47aee480dfcd74daff3dfa07320e7a20a36cdfaabd45da81be9ef38e5e - Sigstore transparency entry: 2255186846
- Sigstore integration time:
-
Permalink:
mgaitan/python-package-copier-template@29932c707177fa2cbe8f3898af6839608d238898 -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@29932c707177fa2cbe8f3898af6839608d238898 -
Trigger Event:
release
-
Statement type:
File details
Details for the file python_package_copier_template-0.6.0-py3-none-any.whl.
File metadata
- Download URL: python_package_copier_template-0.6.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffae43536f427181ff64b7b6a0df12cb9c2512c833430d63904fc040f2fbb6d5
|
|
| MD5 |
726cff73408e7d91fab2c163743656fd
|
|
| BLAKE2b-256 |
338887f096a3f56834e1c0e27673c2b2c97ea05ab499ef8bf177f208c5c38d06
|
Provenance
The following attestation bundles were made for python_package_copier_template-0.6.0-py3-none-any.whl:
Publisher:
cd.yml on mgaitan/python-package-copier-template
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
python_package_copier_template-0.6.0-py3-none-any.whl -
Subject digest:
ffae43536f427181ff64b7b6a0df12cb9c2512c833430d63904fc040f2fbb6d5 - Sigstore transparency entry: 2255186833
- Sigstore integration time:
-
Permalink:
mgaitan/python-package-copier-template@29932c707177fa2cbe8f3898af6839608d238898 -
Branch / Tag:
refs/tags/0.6.0 - Owner: https://github.com/mgaitan
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@29932c707177fa2cbe8f3898af6839608d238898 -
Trigger Event:
release
-
Statement type: