Skip to main content

A setuptools extension for generating OpenAPI clients

Project description

Code CI Test Coverage Latest PyPI version Apache License

A setuptools extension for generating RESTful clients from OpenAPI schema at build time, allowing for easy use of the API with static type checking.

PyPI

pip install setuptools_openapi_generator

Source code

https://github.com/DiamondLightSource/setuptools_openapi_generator

Releases

https://github.com/DiamondLightSource/setuptools_openapi_generator/releases

To generate an API client in your project, simply add setuptools_openapi_generator to the build-system.requires section of your pyproject.toml.

Client generation can be configured via a tool entry in the pyproject.toml as below:

[build-system]
requires = ["setuptools", "setuptools_openapi_generator"]

[tool.setuptools_openapi_generator]
basedir = "src/sample_project/apis/"
sources = [
    "https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/link-example.json",
    "api_definitions/petstore.json"
]

The above example will generate two API clients, at src/sample_project/apis/link_example and src/sample_project/apis/petstore respectively.

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

setuptools_openapi_generator-0.1.1.tar.gz (22.9 kB view hashes)

Uploaded Source

Built Distribution

Supported by

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