A modern Python project template using cookiecutter, designed for professional Python development with opinionated defaults and best practices.
- Modern Python packaging with
pyproject.tomlanduv - src layout for better package management
- Pre-configured tools:
rufffor linting and formattingmypyfor type checkingpytestfor testingtoxfor test automationpre-commithooks
- GitHub Actions workflows for CI/CD
- Optional CLI support with Click and Rich
- Comprehensive project structure with tests, docs, and more
- Python 3.11+
- cookiecutter (
pip install cookiecutteroruv tool install cookiecutter) - uv (recommended for the generated project)
Generate a new project with prompts:
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.gitGenerate a project without prompts by specifying all options:
# Basic Python project
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.git \
--no-input \
project_name="my-awesome-project" \
full_name="Your Name" \
email="your.email@example.com" \
github_username="yourusername"
# Python project with CLI and PyPI publishing
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.git \
--no-input \
project_name="my-cli-tool" \
use_cli="yes" \
publish_to_pypi="yes" \
full_name="Your Name" \
email="your.email@example.com" \
github_username="yourusername" \
project_short_description="A CLI tool for awesome things"When using interactive mode, you'll be prompted for:
full_name: Your nameemail: Your email addressgithub_username: Your GitHub usernameproject_name: Name of your projectproject_slug: Python package name (auto-generated)project_short_description: Brief project descriptionversion: Initial version (default: 0.1.0)python_version: Python version to target (default: 3.12)line_length: Maximum line length (default: 100)use_cli: Whether to include CLI boilerplateuse_claude: Whether to include CLAUDE.md for AI developmentpublish_to_pypi: Whether to include PyPI publishing setup with Test PyPI validationopen_source_license: License choice
your_project/
├── src/
│ └── your_project/
│ ├── __init__.py
│ └── cli.py # If CLI enabled
├── tests/
│ ├── __init__.py
│ ├── conftest.py
│ ├── unit/
│ └── integration/
├── docs/
├── .github/
│ └── workflows/
│ ├── tests.yml
│ └── release.yml
├── .gitignore
├── .pre-commit-config.yaml
├── LICENSE
├── Makefile
├── README.md
├── pyproject.toml
└── tox.ini
This template is designed to work seamlessly with AI coding assistants. When an AI agent needs to create a Python project, it should use the non-interactive mode:
Example AI Agent Commands:
For a basic Python project:
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.git --no-input project_name="project-name" full_name="Developer Name" email="dev@example.com" github_username="devuser"For a CLI tool with PyPI publishing:
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.git --no-input project_name="my-cli-tool" use_cli="yes" publish_to_pypi="yes" full_name="Developer Name" email="dev@example.com" github_username="devuser"For AI development with Claude Code:
cookiecutter https://github.com/m1yag1/cookiecutter-py-project.git --no-input project_name="my-ai-project" use_claude="yes" full_name="Developer Name" email="dev@example.com" github_username="devuser"Required Parameters for AI Agents:
project_name- The project name (will auto-generate project_slug)full_name- Developer's nameemail- Developer's emailgithub_username- GitHub username
Optional Parameters:
use_cli="yes"- Include CLI boilerplate with Clickuse_claude="yes"- Include CLAUDE.md file for AI development contextpublish_to_pypi="yes"- Include PyPI publishing setup with Test PyPI validationpython_version="3.11"- Target Python version (default: 3.12)open_source_license="MIT"- License choice (default: MIT)
After generation, the template will:
- Initialize a git repository
- Create an initial commit
- Provide next steps for setting up the development environment
In your generated project:
# Install development dependencies
uv sync --all-extras
# Install pre-commit hooks
pre-commit install
# Run tests
make test
# Format and lint code
make format
# Run type checking
make typecheck-
Clone the repository:
git clone https://github.com/m1yag1/cookiecutter-py-project.git cd cookiecutter-py-project -
Install development dependencies:
make dev
This project uses comprehensive testing to ensure the cookiecutter template works correctly:
# Run all tests
make test
# Run tests with coverage
make coverage
# Test template generation manually
make template-test
# Run linting
make lint
# Format code
make formattests/test_project_generation.py: Tests for cookiecutter template generation- Uses
pytest-cookiesto test different cookiecutter configurations - Tests cover all template options and generated project structure
- Make your changes to the template files
- Run tests to ensure everything works:
make test - Test the template manually:
make template-test - Run linting and formatting:
make format - Commit your changes
This cookiecutter template is released under the MIT License.