CookiePyStarter — the modern Python cookiecutter template. uv · ruff · mypy · pytest · pre-commit · Docker · CI. uvx cookiecutter gh:mramitdas/CookiePyStarter
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.
| 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.
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:
uv sync (creates .venv, installs runtime + dev groups),uvx-style tooling for pre-commit and the check suite,ruff, mypy, pytest pass before generation ends.uvx cookiecutter gh:mramitdas/CookiePyStarter
cd my_awesome_project
uv run pytest # everything already installed and green
CookiePyStarter generates:
[dependency-groups]
dev = ["mypy", "pre-commit", "pytest", "pytest-cov", "ruff"]
uv sync installs the default group plus your project.docs = ["mkdocs-material"]) select with
uv sync --group docs or --extra docs for extras.uv.lock is committed — every machine and CI run get identical deps.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”.
uv.lock — reproducibility evaporates; commit it..venv into an
unsynced state; reinstall with uv sync --reinstall.uvx tool name so versions stay pinned
per invocation.git init-ed main for you.uvx cookiecutter gh:mramitdas/CookiePyStarter
— a uv-native, src-layout, green-on-first-render Python project.