Rob's Awesome Python Template
The most comprehensive Python project template that scales from simple libraries to enterprise applications
Transform any Python idea into a production-ready project in minutes. This CookieCutter template provides everything you need to build, test, deploy, and maintain modern Python applications with industry best practices baked in.
Quick Links: Quick Start • Core Features • Optional Integrations • Project Examples • Built With This Template
Why Choose This Template?
- Modern Development Tools: Get a fully configured environment with Ruff (formatting/linting), prettier (YAML/JSON/Markdown formatting), mypy (type checking), pytest (testing), and pre-commit hooks ready to use
- Production-Ready Frameworks: Optional integration with FastAPI (web APIs), Celery (distributed tasks), SQLAlchemy + Alembic (database ORM), and QuasiQueue (multiprocessing)
- Professional Infrastructure: Includes Docker containerization, GitHub Actions CI/CD, Pydantic Settings for configuration, and Makefile automation
- Developer-Friendly CLI: Optional Typer integration for building beautiful command-line interfaces with automatic help and shell completion
- AI Ready: Pre-configured AGENTS.md file following the open standard compatible with Cursor, Aider, GitHub Copilot, and other AI coding assistants
- Incredibly Flexible: Mix and match features to create exactly what you need, from simple libraries to full web applications with automatic cleanup of unused code
- Modern Python Standards: Python 3.10+ with async/await support, type hints, contemporary best practices, and pyproject.toml configuration
- Zero Manual Setup: UV automatically downloads and installs the correct Python version - no need for pyenv or manual Python installation
Quick Start
# Install cookiecutter if you haven't already
pip install cookiecutter
# Create your project
cookiecutter gh:tedivm/robs_awesome_python_template
Answer a few questions about your project, and you'll have a complete Python application with everything configured and ready to go!
Core Features (Always Included)
Every project created with this template includes these essential components:
Development Tools
- Makefile automation: Powerful task automation covering setup, testing, formatting, linting, and deployment with simple commands like
make install, make test, and make publish
- Modern pyproject.toml: Centralized project configuration using the modern Python standard, eliminating legacy setup.py files and consolidating all metadata, dependencies, and tool settings in one place
- uv: Lightning-fast Python package installer and virtual environment manager written in Rust, providing 10-100x faster installations than pip with automatic Python version management
- Virtual environment management: Seamless virtual environment creation using uv, automatically installing the correct Python version from
.python-version and managing dependencies efficiently
- Pre-commit hooks: Automated code quality checks that run before every commit, catching formatting issues, security vulnerabilities, and common mistakes before they enter your repository
Code Quality
- Ruff: Blazingly fast Python linter and formatter (10-100x faster than Black) that replaces multiple tools (Flake8, isort, Black) with a single, zero-configuration solution written in Rust
- mypy: Industry-standard static type checker that catches type-related bugs before runtime, providing IDE autocompletion and making refactoring safer
- prettier: Universal code formatter for YAML, JSON, Markdown, and other config files, running via npx with no Python dependency needed and consistent formatting across all supported file types
- pytest: Python's most popular testing framework with powerful fixtures, parametrization, full async/await support, and extensive plugin ecosystem for testing web apps, databases, and more
- Coverage reporting: Comprehensive test coverage tracking with support for multiprocess and distributed applications, ensuring your tests exercise all code paths
Configuration & Settings
- Pydantic Settings: Type-safe configuration management using Pydantic v2, automatically loading and validating settings from environment variables, .env files, and secrets with full IDE support
- Environment-based config: Seamless configuration switching between development, staging, and production environments using environment variables with sensible defaults
- Automatic validation: Runtime validation with clear error messages for misconfigured values, preventing deployment of broken configurations and catching issues during development
Publishing & Distribution
- setuptools-scm: Automatic semantic versioning derived from git tags and commit history, eliminating manual version updates and ensuring version consistency across your project
- PyPI publishing: Streamlined package publishing to PyPI with a single command, including automatic wheel building, source distribution creation, and metadata validation
- Multi-architecture support: Cross-platform compatibility for AMD64 and ARM64 architectures, ensuring your applications work natively on Intel/AMD processors, Apple Silicon, and ARM servers
Optional Integrations
Pick and choose the features you need. Unused components are completely removed from your project.
Web Applications
FastAPI Integration
- Modern, high-performance web framework built on Starlette and Pydantic, providing automatic data validation and serialization
- Automatic interactive API documentation with both Swagger UI and ReDoc interfaces, generated directly from your Python type hints without additional configuration
- Full async/await support for handling thousands of concurrent connections efficiently, perfect for I/O-bound operations like database queries and external API calls
- Static file serving with optimized caching headers for serving frontend applications, images, and assets directly from your API
Task Processing
Celery Integration
- Enterprise-grade distributed task queue for processing millions of tasks per day, with support for task prioritization, routing, and complex workflows using chains, groups, and chords
- Production-proven Redis broker configuration with connection pooling, automatic retries, and result backend for storing task outcomes and enabling result retrieval
- Pre-configured worker and scheduler (beat) containers for running periodic tasks like cron jobs, with separate deployments for different task types and priorities
- Automatic task retry mechanisms with exponential backoff, task revocation, rate limiting, and comprehensive error handling for building resilient asynchronous systems
QuasiQueue Integration
- Lightweight multiprocessing library that provides true parallelism for CPU-bound tasks by bypassing Python's Global Interpreter Lock (GIL), enabling full utilization of multi-core processors
- Async/await native design with automatic queue management and worker process lifecycle handling, eliminating the complexity of manual process spawning and inter-process communication
- Built-in context management for sharing expensive resources like database connection pools and HTTP clients across jobs, reducing initialization overhead
- Type-safe configuration using Pydantic for automatic validation of input data, with configurable queue sizes, worker counts, and graceful shutdown handling
- Perfect for CPU-intensive workloads like data processing, image manipulation, scientific computing, and batch operations that need to scale beyond single-threaded execution
Caching
aiocache Integration
- High-performance async caching library with support for multiple backends including Redis, Memcached, and in-memory storage, providing millisecond-level response times for frequently accessed data
- Automatic cache configuration and connection management with separate cache instances for different TTL requirements: default (5 minutes), persistent (1 hour), and custom durations for specific use cases
- Decorator-based caching with
@cached for effortless function result memoization, automatically serializing complex Python objects including Pydantic models, dataclasses, and custom types
- Built-in cache warming on application startup for Celery workers and web servers, pre-populating critical data to eliminate cold-start latency and ensure consistent performance from the first request
- Type-safe settings configuration for cache behavior including host, port, TTL values, and enable/disable flags, with automatic validation and clear error messages for misconfigurations
- Production-ready Redis integration with connection pooling, automatic reconnection handling, and graceful degradation when cache is unavailable, preventing cascading failures
Database & ORM
SQLAlchemy + Alembic
- SQLAlchemy 2.0+ with full async/await support for non-blocking database operations, enabling high-concurrency applications that can handle thousands of simultaneous database connections
- Powerful ORM with relationship mapping, lazy/eager loading strategies, and advanced querying capabilities including joins, subqueries, window functions, and CTEs
- Automatic model discovery and registration system that finds all your database models without explicit imports, simplifying project organization
- Alembic-powered database migration system for version-controlled schema changes, with automatic migration generation by comparing models to database state, rollback support, and team collaboration features
- Built-in connection pool management with configurable pool sizes, overflow handling, connection recycling, and health checks for production reliability
Paracelsus Integration
- Automatic generation of beautiful database schema diagrams in multiple formats (PNG, SVG, PDF) using Graphviz, visualizing tables, columns, and relationships at a glance
- One-command documentation generation that extracts database comments, column types, constraints, and indexes into comprehensive markdown documentation
- Interactive visual representation of foreign key relationships, many-to-many associations, and table hierarchies to help new developers understand your data model quickly
Command Line Interface
Typer + Click
- Modern CLI framework built on Click that uses Python type hints to automatically generate command-line interfaces, eliminating boilerplate code and providing excellent IDE support
- Beautiful, colorized terminal output with progress bars, spinners, tables, and rich formatting using the Rich library for professional-looking command-line tools
- Automatic help text generation from docstrings and type annotations, with support for command groups, subcommands, and nested command hierarchies
- Type-safe argument and option definitions with automatic validation, conversion, and helpful error messages when users provide incorrect input
- Full async/await support for commands that need to perform I/O operations, with seamless integration with your async application code
- Shell auto-completion for Bash, Zsh, Fish, and PowerShell, generated automatically from your command definitions to improve developer experience
Templating
Jinja2 Templates
- Industry-standard templating engine for generating HTML, XML, emails, and other text formats with Python-like syntax including loops, conditionals, and filters
- Template inheritance and composition with blocks, includes, and macros for building complex page layouts from reusable components while maintaining DRY principles
- Pre-configured custom filters and functions specific to your application domain, with automatic template reloading in development and compilation caching in production
- Built-in XSS protection through automatic HTML escaping, with granular control over when to escape content for security-critical applications
- Seamless integration with FastAPI for server-side rendering, perfect for hybrid applications that combine API endpoints with traditional server-rendered pages
Containerization
Docker Setup