A modern Copier template for scaffolding Python packages and applications with best practices built-in.
- 📦 Modern Python packaging using UV for lightning-fast dependency management
- ⚡️ Streamlined task execution with poethepoet
- ✍️ Code formatting and linting with Ruff
- 🔍 Type checking with ty
- 🛡️ Quality gates with Pre-commit hooks
- 🏷️ Automated versioning following Conventional Commits with Commitizen
- 📋 Changelog generation compatible with Keep A Changelog
- 🔄 Continuous integration with GitHub Actions
- 🏗️ Template updates with Copier for easy maintenance
-
Install UV globally:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Generate your project:
# Create in a new directory uvx --with jinja2-time copier copy https://github.com/gotofritz/copier-python-template my-project/ --trust # Or create in current directory mkdir my-project && cd my-project uvx --with jinja2-time copier copy https://github.com/gotofritz/copier-python-template . --trust
Note:
--trustand--with jinja2-timeare required because the template enables thejinja2-timeJinja extension, which puts the current year in theLICENSE. -
Configure your project by answering the interactive prompts:
Prompt Default Notes project_nameLetters, digits, -and_org_namegotofritzGitHub org or user package_namederived from project_namePython import name project_descriptionA Python packageproject_urlhttps://github.com/<org>/<project>author_name,author_emailgotofritzpython_version3.13Minimum supported version with_conventional_commitstrueAdds Commitizen and the commit-msghookclitrueAdds a Click CLI entrypoint -
Initialize Git and create remote repository:
cd my-project git init # Using GitHub CLI (recommended) gh repo create my-org/my-project --private --source=. --push # Or follow GitHub's instructions to push an existing repository
-
Set up dependencies:
uv sync git add uv.lock && git commit -m "feat: add dependency lock file"
Keep your project aligned with the latest template improvements:
uvx --with jinja2-time copier update --trustIf conflicts arise, resolve them by inspecting the generated .rej files.
When you enable CLI support during project creation, the template generates a ready-to-use command-line interface:
- Automatic script installation named after your project (kebab-case)
- Sample commands to get you started
- Easy customization via
pyproject.toml
Example usage:
❯ my-project --help
Usage: my-project [OPTIONS] COMMAND [ARGS]...
Main entry point for the CLI.
Options:
-v, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
simple-command This is a simple command.
subcommand This contains sub-subcommandsTo test modifications to this template:
uvx --with jinja2-time copier copy ./copier-python-template --trust --vcs-ref=HEAD my-test-project- Fork this repository
- Update all occurrences of
gotofritzto your GitHub username - Customize the template to match your preferences
- Use your forked version in the copy commands above
Your generated project comes with:
- Modern Python packaging with PEP 621 compliant
pyproject.toml - Development tools pre-configured and ready to use
- GitHub Actions CI (
.github/workflows/ci.yml) running pre-commit andpoe qaon every push and pull request tomain - Coverage badge: on pushes to
main, CI publishescoverage.svgto abadgesbranch (created on the first run) and the README links to it - Pre-commit hooks for file hygiene, TOML sorting and Ruff on commit, the full
poe qaon push, and Commitizen oncommit-msgwhen conventional commits are enabled - MIT license: a
LICENSEfile with the current year and the author's name, referenced frompyproject.toml - Documentation structure with a README and a
docs/folder (the changelog is generated by Commitizen oncz bump) - Testing setup with pytest and coverage reporting (95% minimum in generated projects)
This repository has its own workflow and pre-commit config. Run the same checks locally with:
uv sync
uv run pre-commit run --all-files --hook-stage manual
uv run poe qa