Skip to main content

Modern Python package template

Copier CI PyPI Changelog

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 supporting Python 3.12-3.15
  • 📦 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 example ty) 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 include check-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 optional LICENSE
  • 🤖 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

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.

Metadata

Release files for python-package-copier-template 0.7.0

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-package-copier-template 0.7.0
File Size Uploaded
python_package_copier_template-0.7.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-package-copier-template 0.7.0
File Interpreter ABI Platform
python_package_copier_template-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.9 kB

Release files / python_package_copier_template-0.7.0.tar.gz

Download URL python_package_copier_template-0.7.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f1d112e4c710e85a07484fa8315105de2956950bd91d7ccc258ef0306cc87c52
BLAKE2b-256 checksum
How to use checksums
2226712adb201301498d3157d4a2cc961301a3dcc0357a56aa2d1a88460bc804
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

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 Sep 12, 2026.

Transparency log

Release files / python_package_copier_template-0.7.0-py3-none-any.whl

Download URL python_package_copier_template-0.7.0-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a1c8afa1285921b135fc67fd9a55f9df21ff65ffd1311ddad82517b9428ff73
BLAKE2b-256 checksum
How to use checksums
9f7e215ce3a68dac5ac9ff749c09b9a0ffc7fdca822e244a2af77d8f83e7f04b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.13 {"installer":{"name":"uv","version":"0.12.13","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}

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 Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.1

2 release files

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.3

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