A Copier-based template for bootstrapping consistent, production-ready Python OpenAPI client projects.
This template provides:
- Reproducible project structure for Python OpenAPI clients with modern PEP 621 packaging
- UV-powered development with fast, reliable dependency management and lock files
- Modern build system using Hatchling for streamlined packaging
- Shared runtime libraries (openapi-client-core) for common concerns like retries, rate limiting, and pagination
- Easy template updates using copier to keep multiple client repositories in sync
- Standard CI/CD workflows to ensure quality and consistency across all generated clients
- Optional features like MCP (Model Context Protocol) support and CLI interfaces
Install UV (recommended) for fast dependency management:
curl -LsSf https://astral.sh/uv/install.sh | shOr use pip if you prefer:
pip install uv-
Install Copier:
uv tool install copier
-
Generate a new client project:
uvx copier copy gh:dougborg/openapi-client-template my-api-client
-
Follow the interactive prompts to configure your project, or provide values directly:
uvx copier copy gh:dougborg/openapi-client-template my-api-client \ --data project_name="My API Client" \ --data api_service="myservice" \ --data include_mcp=true
-
Set up your new project:
cd my-api-client uv sync
To pull in the latest template changes to an existing project created from this template:
-
Navigate to your client project directory
-
Run:
uvx copier update --trust
Or use the provided sync script from the template repository:
python scripts/sync-template.py /path/to/your-client-project --trustTo contribute to this template:
-
Clone the repository:
git clone https://github.com/dougborg/openapi-client-template.git cd openapi-client-template -
Set up development environment:
uv sync --all-extras
-
Run tests:
uv run pytest
-
Lint and format code:
uv run ruff check . uv run ruff format .
- template/: The Copier template that is expanded into each new client repo
- Generated projects include: pyproject.toml, src/, tests/, docs/, CI workflows, and configuration files
- shared-libs/: Shared Python packages for reusable code (e.g., openapi-client-core)
- scripts/: Helper scripts for template synchronization and release management
- .github/: CI workflows for template repository maintenance
This template follows Semantic Versioning:
- Major versions (e.g., 2.0.0): Breaking changes to template structure, required variable changes, or major feature removals
- Minor versions (e.g., 1.1.0): New features, new template files, new optional variables, or significant enhancements
- Patch versions (e.g., 1.0.1): Bug fixes, documentation improvements, or minor template refinements
When you update your project using copier update, you can choose which version to pull from. See CHANGELOG.md for version history.
The template supports the following configuration variables (defined in copier.json):
project_name: Human-readable project name (e.g., "My OpenAPI Client")project_slug: URL/package-friendly name (e.g., "my-openapi-client")package_name: Python package name (e.g., "my_openapi_client")api_service: Name of the API service being wrappedinclude_mcp: Include Model Context Protocol support (true/false)author_name: Project author/maintainer namelicense: License type (default: MIT)python_version: Minimum Python version (e.g., "3.11")
Contributions are welcome! Please see CONTRIBUTING.md for guidelines on:
- Testing the template locally
- Making changes to template files
- Submitting pull requests
- Release process
This project follows the Contributor Covenant Code of Conduct. By participating, you agree to uphold this code.
This template is released under the MIT License. Projects generated from this template will include their own MIT license by default (configurable via the license variable).
See open issues and project boards for planned enhancements and feature requests.