Contributing to create-awesome-python-app
Learn how to contribute templates and extensions to the project
Contribution Overview
The create-awesome-python-app project welcomes contributions from the community. You can contribute by:
- Adding new templates
- Adding new extensions
- Improving existing templates or extensions
- Fixing bugs or adding features to the CLI
This guide focuses on contributing templates and extensions, which are the most common types of contributions.
Contribution Workflow
Contributing New Templates
Templates are the foundation of create-awesome-python-app. They provide the initial structure and configuration for new projects. This guide will walk you through the process of creating and contributing a new template.
1Template Structure
A template is essentially a complete project structure that serves as a starting point. Here's the recommended structure for a template:
templates/
└── your-template-name/
├── src/ # Application source (layout varies by template)
│ ├── app/ # FastAPI/Django modules
│ └── ...
├── tests/ # pytest suite
├── .gitignore
├── pyproject.toml # uv project metadata, scripts, and dependencies
├── uv.lock # Lockfile (generated after uv sync)
├── README.md # Template documentation
└── AGENTS.md # AI assistant contract2Adding Your Template to templates.json
Each template must be registered in the templates.json file. This file helps the CLI understand how to use and present your template.
{
"templates": [
// ... existing templates
{
"name": "Your Template Name",
"slug": "your-template-name",
"description": "A concise description of your template",
"url": "https://github.com/Create-Python-App/cpa-templates/tree/main/templates/your-template-name",
"type": "template-type",
"category": "category-slug",
"labels": ["Label1", "Label2", "Label3"]
}
]
}Here's what each property means:
- name: The display name of your template
- slug: A unique identifier for your template (URL-friendly)
- description: A brief description of what your template offers
- url: The URL to your template in the repository
- type: The type of template (e.g., "fastapi-backend", "django-backend", "cli-app", "celery-worker", "uv-workspace")
- category: The category slug from the categories section
- labels: Keywords that describe your template
3Creating a Template
Follow these steps to create a new template:
- Start with a working project: Begin with a fully functional project that you want to turn into a template.
- Clean up the project: Remove any unnecessary files, personal configurations, or environment-specific settings.
- Add template documentation: Create a comprehensive README.md that explains the template's purpose, features, and usage.
- Add custom options (optional): If your template supports customization, add a
customOptionsproperty to your template entry intemplates.json. - Test your template: Ensure that your template can be used to create a new project that works correctly.
// Example of customOptions in templates.json
"customOptions": [
{
"name": "srcDir",
"type": "text",
"message": "Subdirectory to put all source content (e.g., `src`). Leave blank to use the root directory.",
"initial": "src"
},
{
"name": "projectImportPath",
"type": "text",
"message": "Import alias to use for the project, e.g., `@/`",
"initial": "@/"
}
]4Submitting Your Template
Once your template is ready, you can submit it for inclusion in the create-awesome-python-app project:
- Fork the repository: Create a fork of the cpa-templates repository on GitHub.
- Add your template: Place your template in the
templates/directory. - Update templates.json: Add your template to the
templates.jsonfile as described above. - Create a pull request: Submit a pull request with a clear description of your template.
Template Review Process
Contributing Extensions
Extensions enhance templates with additional functionality. They are modular and can be applied to compatible templates.
1Extension Structure
An extension typically consists of files that will be added to or modified in a template. Here's a recommended structure:
extensions/
└── your-extension-name/
├── files/ # Files to be added to or merged into the template
├── pyproject/ # Optional dependency fragments for pyproject.toml merge
├── extension.json # Metadata, compatibility, and merge rules
└── README.md # Extension documentation2Adding Your Extension to templates.json
Each extension must be registered in the templates.json file:
{
"extensions": [
// ... existing extensions
{
"name": "Your Extension Name",
"slug": "your-extension-name",
"description": "A concise description of your extension",
"url": "https://github.com/Create-Python-App/cpa-templates/tree/main/extensions/your-extension-name",
"type": ["template-type1", "template-type2"],
"category": "Extension Category",
"labels": ["Label1", "Label2", "Label3"]
}
]
}Here's what each property means:
- name: The display name of your extension
- slug: A unique identifier for your extension (URL-friendly)
- description: A brief description of what your extension offers
- url: The URL to your extension in the repository
- type: The type(s) of templates this extension is compatible with (string or array of strings)
- category: The category of the extension (e.g., "containers", "database", "observability", "security", "ci")
- labels: Keywords that describe your extension
3Creating an Extension
Follow these steps to create a new extension:
- Identify the need: Determine what functionality you want to add to existing templates.
- Create the extension files: Prepare the files that will be added to or modified in the template.
- Define dependencies: Declare Python packages your extension adds in a
pyproject/fragment or equivalent merge file consumed by the CLI. - Add scripts or tasks: If your extension needs Makefile targets or documented
uv runcommands, include them in the extension README and any task runner config. - Document your extension: Create a README.md that explains how to use your extension and what it provides.
# Example pyproject dependency fragment (conceptual) [project] dependencies = [ "httpx>=0.27", "sqlalchemy>=2.0", ] [dependency-groups] dev = [ "pytest-cov>=5.0", ]
4Ensuring Compatibility
Extensions must be compatible with the templates they're designed for. Here's how to ensure compatibility:
- Specify compatible template types: In your extension's entry in
templates.json, list all compatible template types in thetypeproperty. - Test with all compatible templates: Verify that your extension works correctly with all the template types you've specified.
- Handle template variations: If templates have different structures (e.g., with or without a
srcdirectory), make your extension adaptable.
// Example of specifying multiple compatible template types "type": ["fastapi-backend", "django-backend", "cli-app"]
5Submitting Your Extension
The process for submitting an extension is similar to submitting a template:
- Fork the repository: Create a fork of the cpa-templates repository on GitHub.
- Add your extension: Place your extension in the
extensions/directory. - Update templates.json: Add your extension to the
templates.jsonfile as described above. - Create a pull request: Submit a pull request with a clear description of your extension.
Best Practices for Template and Extension Design
Project Structure
- Follow a clear and logical directory structure
- Group related files together
- Use consistent naming conventions
- Include appropriate configuration files
Code Quality
- Include Ruff and pytest configuration where applicable
- Use type hints and optional mypy/pyright settings
- Add comprehensive docstrings where behavior is non-obvious
- Follow Python and framework best practices (FastAPI, Django, Typer, Celery)
Documentation
- Provide a detailed README.md
- Include usage examples
- Document available
uv runcommands and Makefile targets - Explain any non-standard configurations
Compatibility
- Ensure compatibility with supported extensions
- Use the latest stable versions of dependencies
- Test with different Python versions
- Consider cross-platform compatibility