Skip to main content

Python OpenAPI Client Generator made OK

Project description

okapipy

okapipy

CI PyPI Python versions License

Quality Gate Coverage Maintainability Ruff pre-commit Checked with mypy

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.0.tar.gz (566.9 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.0-py3-none-any.whl (96.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: okapipy-0.1.0.tar.gz
  • Upload date:
  • Size: 566.9 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.0.tar.gz
Algorithm Hash digest
SHA256 ad17a47fb5bfeaa7ea0fceac2076749c75b04f63f7d2b88153d4609a0989e8f8
MD5 148292ce4261eb4c178c192965fc30f8
BLAKE2b-256 2d1d8601dec5657efa3cc50743835e29799015387cbe07f2bea8eb5b9b13024e

See more details on using hashes here.

Provenance

The following attestation bundles were made for okapipy-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: okapipy-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 96.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8fbd63dd8c06336a780f100dbaf7be8e363551093d492da661d01007814c1787
MD5 edb62c68222efcb57418b555e7f35d4d
BLAKE2b-256 7a04d15e9e1cd656fd2d2fe85187275e87d314ce597e10629dbb956b61fd8a5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for okapipy-0.1.0-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