A Cookiecutter template for Python packages, supporting both CLI and library project types. Generates projects with uv, ruff, ty, and pytest pre-configured. It also comes with GitHub Actions workflows configured for the project.
This template is opinionated and enforces recommended practices when creating new Python projects.
{{cookiecutter.project_slug}}/- Template directory (rendered by Cookiecutter)cookiecutter.json- Template variables and promptshooks/- Pre/post generation scriptspre_gen_project.py- Validates inputs (namespace, slug, entry point)post_gen_project.py- Cleans up unused files based on options
| Variable | Purpose |
|---|---|
project_name |
Human-readable name |
project_slug |
Pip/repo name (auto-derived) |
project_namespace_import |
Optional namespace (e.g., company.tools) |
repo_type |
CLI or library |
entry_point |
CLI command name (CLI only) |
Generate a test project to verify template changes:
# Generate in temp directory
uvx cookiecutter -o /tmp .
# Or with specific options (no prompts)
uvx cookiecutter --no-input -o /tmp . project_name="Test Project" repo_type="CLI"Then verify the generated project:
cd /tmp/test-project
make lint && make testWhen modifying the template:
- Ensure Jinja2 syntax is valid in template files
- Test both
CLIandlibraryrepo types - Test with and without
project_namespace_import - Verify generated project passes
make lint && make test
- Summary line: max 50 chars (hard limit 72)
- Body lines: max 72 chars
- Use Markdown formatting in description