Skip to content

About

Copier template for standardized Python projects — ruff, ty, prek, FastMCP, cyclopts, CI/CD

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

python-template

A copier template for Python projects. You answer a few questions, and it spits out a project with linting, type checking, tests, CI, and security scanning configured.

Uses the Astral toolchain (uv, ruff, ty). CI runs on self-hosted GitHub Actions runners.

Quick start

uvx copier copy gh:aliparoya/python-template my-project
cd my-project
uv sync --dev
make verify

Copier asks for a project name, Python version, and which optional features you want. After that, make verify and make test pass immediately.

What's included

  • hatchling build system, src layout
  • ruff for linting and formatting (Google docstrings, security rules, isort)
  • ty for type checking
  • prek for pre-commit hooks (ruff, gitleaks, ty)
  • pytest with async support (pytest-asyncio)
  • pydantic v2 as a base dependency
  • GitHub Actions CI (lint + test) and security scanning (dependency review, bandit via ruff, trivy, gitleaks)
  • CodeRabbit config with assertive review profile
  • CLAUDE.md with commands, architecture conventions, and standard toolkit
  • .editorconfig, .gitleaks.toml, dependabot.yml, Makefile

Optional features

Flag What it adds
include_cli Cyclopts CLI entrypoint with Pydantic type support
include_mcp FastMCP v3 server with tool/resource examples
include_docker Multi-stage Dockerfile (python-slim + uv, non-root user)
include_pypi_publish Release workflow: build on tag push, publish to PyPI via trusted OIDC, GitHub release with git-cliff changelog
include_docs MkDocs Material site with GitHub Pages deployment

Template variables

Variable Default Notes
project_name (required) Package name, repo URL
project_slug auto Derived from project_name, underscored
project_description (required) One-liner for pyproject.toml and docs
author_name (required)
author_email (required)
github_username AnvilCortex Org or personal account
python_version 3.12 3.11, 3.12, or 3.13
license Proprietary MIT, Apache-2.0, or Proprietary

Opinions

The generated CLAUDE.md is opinionated:

  • Async by default for I/O. Sync for pure computation.
  • Fail fast. Raise on errors. Don't catch exceptions unless you can actually do something about them.
  • One responsibility per file. No monoliths.
  • Tests cover features, not lines. Five tests for five behaviors beats 280 that break on every refactor.
  • Standard toolkit: polars (not pandas), httpx, throttled-py, Kreuzberg, MarkItDown, pydantic, dataframely.

Adopting in an existing project

If you have a repo that wasn't generated from this template, paste this into Claude Code:

Adopt the python-template from gh:aliparoya/python-template into this project.

1. Clone the template repo to /tmp and read its CLAUDE.md to understand the conventions.
2. Determine which optional features apply to this project (CLI, MCP, Docker, docs, PyPI publish) based on what already exists.
3. Run `uvx copier copy --overwrite` with the right flags into this repo on a new branch.
4. Merge the generated config into what already exists — keep existing deps and project-specific config, take the template's ruff/ty/pytest/pre-commit/CI/security setup.
5. Delete files that don't apply and resolve any conflicts.
6. Run `make verify` and fix anything that fails.
7. Read the CLAUDE.md that was generated and refactor source code to match its conventions — async I/O, fail-fast error handling, modular files, feature-level tests.
8. Run `make verify && make test` until everything passes.
9. Commit the result.

After adoption, uvx copier update pulls in future template changes.

Updating a project

uvx copier update

Copier tracks which template version generated your project and merges in newer changes.

Requirements

About

Copier template for standardized Python projects — ruff, ty, prek, FastMCP, cyclopts, CI/CD

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages