Skip to main content

Python OpenAPI Client Generator made OK

Project description

okapipy

okapipy

CI PyPI Python versions License

Quality Gate Coverage Maintainability pre-commit Checked with mypy Ruff

A Python OpenAPI client generator that lifts the flat list of paths in an OpenAPI 3.x document into a hierarchical tree of Namespace → Collection → Resource → (Sub-Collection | Action) and emits a strongly-typed, async/sync Pydantic v2 client from it.

Installation

okapipy requires Python 3.12+ and uses uv for dependency management.

uv add okapipy            # add to an existing project
# or, for one-off use:
uvx okapipy --help

The first NLP-dependent run downloads the spaCy en_core_web_sm model (~12 MB) into ./.spacy/. To pre-warm it:

uv run okapipy nlp fetch en

Usage

Parse a spec into its structural tree (path or http(s) URL accepted):

uv run okapipy spec parse openapi.yaml --output tree.yaml

Generate a full client project:

uv run okapipy spec generate openapi.yaml \
    --output ./my-client \
    --package acme.commerce \
    --client-class CommerceClient

This writes a complete Python project under ./my-client with a regeneratable base layer (src/acme/commerce/base/...) and a one-shot user layer of subclass stubs you can safely customize. Re-running the command refreshes the base layer while preserving your edits in the user layer.

Useful flags:

  • --rules path/to/rules.yaml — project-local overrides for namespace assignment, segment kind, and operation exclusion (mirrors the x-okapipy-* extensions; rules-file values win on conflict).
  • --strip-prefix /api/v1 — drop a base prefix from every path before classification.
  • --check — CI dry-run: report drift and stale files, exit non-zero on any change.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

okapipy-0.1.1.tar.gz (567.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

okapipy-0.1.1-py3-none-any.whl (96.8 kB view details)

Uploaded Python 3

File details

Details for the file okapipy-0.1.1.tar.gz.

File metadata

  • Download URL: okapipy-0.1.1.tar.gz
  • Upload date:
  • Size: 567.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okapipy-0.1.1.tar.gz
Algorithm Hash digest
SHA256 446b3401d5dbe983768ee6763ece1f0a6cc2f21608c556b02f3c41840d31dd78
MD5 36c34a9ab0457b37753a500e75554b0a
BLAKE2b-256 69c5d07f8b844fa605a6f44bbb6df3db34bc224291246771f307909d82044d4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for okapipy-0.1.1.tar.gz:

Publisher: release.yml on ffaraone/okapipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file okapipy-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: okapipy-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 96.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for okapipy-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ccc53ce1dfdd5538139c5439f9651dfe45bdbe013300e57311add74dc7c71251
MD5 b57e9828742898d02a98994e2ffb0408
BLAKE2b-256 3d2560561fe2ac7aa64c91dcc4bb91662c50ea19926f5ed13edd58ffa25a3a66

See more details on using hashes here.

Provenance

The following attestation bundles were made for okapipy-0.1.1-py3-none-any.whl:

Publisher: release.yml on ffaraone/okapipy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page