Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. FastAPI
  3. openapi-python-client

openapi-python-client

MITPythonv0.28.3

Generate modern, type-annotated Python client libraries from OpenAPI 3.0 and 3.1 specifications.

GitHubGitHub
1.9k stars277 forks0 contributors

What is openapi-python-client?

openapi-python-client is a Python tool that automatically generates modern, type-annotated client libraries from OpenAPI 3.0 and 3.1 specifications. It solves the problem of manually writing API clients by producing ready-to-use Python modules with models, API functions, and authentication classes. The generated code is designed to be clean, maintainable, and leverage the latest Python features.

Target Audience

Python developers and teams who need to interact with REST APIs described by OpenAPI specifications and want an automated, customizable way to generate type-safe client SDKs.

Value Proposition

Developers choose this tool because it's written in Python, making it easy to install and extend, and it focuses on generating high-quality, modern Python code with extensive configuration options. Unlike some generators, it provides a tailored experience for Python developers with features like custom templates and post-generation formatting.

Overview

Generate modern Python clients from OpenAPI

Use Cases

Best For

  • Generating type-safe Python clients for internal or public REST APIs
  • Automating SDK creation as part of a CI/CD pipeline
  • Customizing generated client code structure with Jinja2 templates
  • Integrating with Poetry or PDM for dependency management
  • Ensuring consistent code style with automatic Ruff formatting
  • Handling OpenAPI 3.1 specifications with modern Python features

Not Ideal For

  • Projects relying on OpenAPI 2.x (Swagger) specifications without conversion tools
  • APIs requiring full OpenAPI 3.x feature support, as the generator is still in development
  • Teams needing a zero-configuration, out-of-the-box solution without customization or template tweaks

Pros & Cons

Pros

Modern Type Safety

Generates clients using Python type annotations, dataclasses, and enums, ensuring robust and maintainable code as highlighted in the README's focus on 'latest and greatest Python features'.

Template Customization

Supports custom Jinja2 templates via the --custom-template-path flag, allowing developers to tailor generated code structure and style without overriding all templates.

Configurable Output

Offers extensive YAML/JSON configuration for class names, package metadata, enums, and post-generation hooks, enabling fine-tuned control over the generated client.

Tool Integration

Automatically runs Ruff for code formatting via post_hooks and supports multiple package managers (Poetry, PDM, setup.py), fitting into modern Python workflows.

Cons

Incomplete OpenAPI Support

The README explicitly states 'This project is still in development and does not support all OpenAPI features,' limiting its use for complex or advanced APIs.

Unstable Customization API

Custom templates are labeled a 'beta-level feature' with an 'undocumented and unstable' API, posing risks for teams relying on deep customization.

Setup Complexity

Requires pipx with --include-deps for optimal installation to ensure Ruff is available, adding an extra step compared to simpler, all-in-one tools.

Frequently Asked Questions

Quick Stats

Stars1,936
Forks277
Contributors0
Open Issues85
Last commit14 days ago
CreatedSince 2020

Tags

#fastapi#generator#sdk-generation#rest-api#python3#python#openapi#type-annotations#api-client#openapi3#code-generation#python-client

Built With

J
Jinja2
P
Python
R
Ruff

Included in

FastAPI11.2k
Auto-fetched 1 day ago

Related Projects

Full Stack FastAPI and PostgreSQL - Base Project GeneratorFull Stack FastAPI and PostgreSQL - Base Project Generator

Full stack, modern web application template. Using FastAPI, React, SQLModel, PostgreSQL, Docker, GitHub Actions, automatic HTTPS and more.

Stars42,800
Forks8,439
Last commit2 days ago
FastAPI templateFastAPI template

Feature rich robust FastAPI template.

Stars2,776
Forks236
Last commit1 day ago
FastAPI and React TemplateFastAPI and React Template

🚀 Cookiecutter Template for FastAPI + React Projects. Using PostgreSQL, SQLAlchemy, and Docker

Stars2,583
Forks372
Last commit2 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub