Skip to content

rafahuelin/cookiecutter-docker-python-uv

Repository files navigation

GitHub release License: MIT Made with Cookiecutter

🍪 Cookiecutter Python Template

A clean Cookiecutter template for building production-ready Dockerized Python apps with:

  • Docker
  • uv
  • Devcontainers
  • Ruff
  • pre-commit hooks.

Generate project

Install uv if you still don't have it and execute:

latest version:

uvx cookiecutter gh:rafahuelin/cookiecutter-docker-python-uv

specific version (v1.0.1 in this example):

uvx cookiecutter gh:rafahuelin/cookiecutter-docker-python-uv --checkout v1.0.1

create project without input

uvx cookiecutter gh:rafahuelin/cookiecutter-docker-python-uv --no-input project_name="My project"  description="My Python app" python_version="3.14"

Output Preview

📁 your-project/
├── .devcontainer/
│   ├── .env
│   ├── devcontainer.json
│   └── docker-compose.dev.yml
├── src/
│   └── main.py
├── tests/
│   ├── conftest.py
│   └── test_main.py
├── .env
├── .env.example
├── .gitignore
├── .pre-commit-config.yaml
├── .python-version
├── Dockerfile
├── pyproject.toml
├── README.md
└── uv.lock

Quick start

  1. Generate Project Generate Project
  2. Open Project Open Project
  3. Install Devcontainers extension Install Devcontainers extension
  4. Run Tests with coverage Run tests with coverage
  5. Debug Tests Debug Tests
  6. Linter Linter

Features

  • Dockerized Python Development setup with global uv setup (without virtual environment)
  • Uses only actively supported CPython versions
    • Offered at project creation and pinned in the base image and .python-version.
  • Single Dockerfile for dev and production
    • Develop locally with the same Dockerfile that builds your production image.
  • VS Code Dev Container setup
    • Docker Compose-based dev environment.
    • Workspace is bind-mounted so Git status and changes behave exactly as on the host.
    • User UID and GID makes possible to edit files from inside or outside the devcontainer.
    • Linter with Error Lens and Ruff.
  • Fast dependency management with uv
    • pyproject.toml-based workflow with uv for speedy, reproducible installs.
  • Testing scaffold
    • pytest pre-configured with example tests.
    • coverage library pre-installed.
  • Pre-commit hooks ready
    • Linting/formatting hooks configured via .pre-commit-config.yaml.
  • Environment management
    • .env.example provided; .env consumed by the dev setup.

About

Cookiecutter template for Dockerized Python projects with uv.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors