CookiePyStarter

CookiePyStarter — the modern Python cookiecutter template. uv · ruff · mypy · pytest · pre-commit · Docker · CI. uvx cookiecutter gh:mramitdas/CookiePyStarter

View the Project on GitHub

uv + Cookiecutter: Dependency Management That Doesn’t Hurt

Traditional Python projects still carry a stack of plain-text requirements files, a hand-sourced virtual environment, and a wiki page explaining “ which interpreter version” — while uv deletes every step of that ritual. This guide shows how uv cookiecutter setups work and why CookiePyStarter builds on uv end to end.

What uv replaces

Old ritual With uv
python -m venv venv + careful activation uv sync creates .venv automatically
pip install -r requirements/dev.txt uv sync (groups from pyproject.toml)
pip freeze > requirements.txt drift uv.lock pins a reproducible graph
pipx for CLI tools uvx <tool> caches and run on demand
Four config files for four tools ruff + mypy config inside pyproject.toml

uv is a single static binary, is fastest-in-class, understands standard meta (PEP 621, PEP 735), and is now the default recommendation across the Python tooling ecosystem.

Where cookiecutter fits

A uv cookiecutter template means: after generation, the very next command is uv sync — or better, the template has already run it. CookiePyStarter’s post-generation hook:

  1. runs uv sync (creates .venv, installs runtime + dev groups),
  2. runs uvx-style tooling for pre-commit and the check suite,
  3. verifies ruff, mypy, pytest pass before generation ends.
uvx cookiecutter gh:mramitdas/CookiePyStarter
cd my_awesome_project
uv run pytest   # everything already installed and green

The dependency-group pattern

CookiePyStarter generates:

[dependency-groups]
dev = ["mypy", "pre-commit", "pytest", "pytest-cov", "ruff"]

In CI

CookiePyStarter’s generated GitHub Actions workflow (and the template’s own render-test matrix) use astral-sh/setup-uv with cache enabled:

- uses: astral-sh/setup-uv@v7
  with:
    enable-cache: true
- run: uv sync
- run: uv run pytest

Cold caches, warm keys: jobs finish in the time pip used to spend printing “Collecting”.

Common gotchas

Try it

uvx cookiecutter gh:mramitdas/CookiePyStarter

— a uv-native, src-layout, green-on-first-render Python project.