APIMAN
APIMAN integrates OpenAPI documentation and schema-based request validation into Python web applications without requiring a framework rewrite.
Features
- Integrations for Starlette, Flask, Django, Bottle, Tornado, and Falcon
- OpenAPI 2.0, OpenAPI 3.0.x, and OpenAPI 3.1.x specification validation
- Built-in Swagger UI and ReDoc endpoints
- Specifications from docstrings, YAML strings, dictionaries, YAML files, or JSON files
- Validation for query, header, cookie, path, JSON, XML, and form request data
- Synchronous and asynchronous validation APIs
Installation
pip install -U apiman
Install the web framework you use separately, for example:
pip install starlette uvicorn
Quick start
from starlette.applications import Starlette
from starlette.requests import Request
from starlette.responses import JSONResponse
from apiman.starlette import Apiman
app = Starlette()
apiman = Apiman()
apiman.init_app(app)
@app.route("/hello", methods=["GET"])
async def hello(request: Request):
"""
summary: Say hello
parameters:
- name: name
in: query
required: true
schema:
type: string
responses:
"200":
description: Successful response
"""
apiman.validate_request(request)
return JSONResponse({"message": f"Hello, {request.query_params['name']}!"})
Run the application and open:
- Swagger UI:
http://localhost:8000/apiman/swagger/ - ReDoc:
http://localhost:8000/apiman/redoc/ - OpenAPI document:
http://localhost:8000/apiman/specification/
Documentation
The full guide covers framework setup, specification sources, reusable schemas, request validation, and project maintenance:
The documentation can also be built locally:
make docs
Development
APIMAN supports Python 3.9 through 3.12. This project uses uv and Ruff:
make install # create/sync .venv
make lint # Ruff + mypy
make test # lint + tests + coverage
make test-all # Python 3.9-3.12 via Nox
make docs # strict MkDocs build
make build # sdist and wheel
make format rewrites Python files and is intentionally separate from the read-only quality checks.
Compatibility Notes
APIMAN validates assembled specifications with bundled OpenAPI 2.0, 3.0.x, and 3.1.x schemas. Header parameter names are matched case-insensitively; query, cookie, and path parameter names remain case-sensitive.
Request validation supports JSON, XML, form, query, header, cookie, and path inputs. Repeated query and form values are accepted for array schemas. Repeated values for scalar schemas remain invalid.
Use apiman.reset() to clear collected route/schema caches and apiman.reload(...) to clear caches and collect routes again through the active framework adapter.
The built-in Swagger UI and ReDoc templates use pinned jsDelivr CDN versions, not @latest. Serving those endpoints requires browser access to jsDelivr unless you customize the templates to serve local assets.
License
APIMAN is licensed under the BSD 3-Clause License.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file apiman-0.5.5.tar.gz.
File metadata
- Download URL: apiman-0.5.5.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df620db7ff73fc862bfcf2f67236dd46426a6536757b147a6679af459078f498
|
|
| MD5 |
8d6c7897a26b7c014a54490e5daa75e2
|
|
| BLAKE2b-256 |
ed4d321af0e01033023c16ae8759458653197b1eac542e39fa20b2c37c668d8d
|
Provenance
The following attestation bundles were made for apiman-0.5.5.tar.gz:
Publisher:
test-and-release.yml on strongbugman/apiman
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apiman-0.5.5.tar.gz -
Subject digest:
df620db7ff73fc862bfcf2f67236dd46426a6536757b147a6679af459078f498 - Sigstore transparency entry: 2172759940
- Sigstore integration time:
-
Permalink:
strongbugman/apiman@763dc5f2f06304c609328542c1d69e312a20300f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/strongbugman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-and-release.yml@763dc5f2f06304c609328542c1d69e312a20300f -
Trigger Event:
push
-
Statement type:
File details
Details for the file apiman-0.5.5-py3-none-any.whl.
File metadata
- Download URL: apiman-0.5.5-py3-none-any.whl
- Upload date:
- Size: 34.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f95f85bad296926ed5cd0c90042c3b0c03efd65b5dffae1e09895f0fca55f90d
|
|
| MD5 |
f180bdad5415f150641b01928a77108f
|
|
| BLAKE2b-256 |
19821e68cca7fd2656612f766f37b3a04d2f69c4737e67cce8e756023a018762
|
Provenance
The following attestation bundles were made for apiman-0.5.5-py3-none-any.whl:
Publisher:
test-and-release.yml on strongbugman/apiman
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
apiman-0.5.5-py3-none-any.whl -
Subject digest:
f95f85bad296926ed5cd0c90042c3b0c03efd65b5dffae1e09895f0fca55f90d - Sigstore transparency entry: 2172759965
- Sigstore integration time:
-
Permalink:
strongbugman/apiman@763dc5f2f06304c609328542c1d69e312a20300f -
Branch / Tag:
refs/heads/master - Owner: https://github.com/strongbugman
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
test-and-release.yml@763dc5f2f06304c609328542c1d69e312a20300f -
Trigger Event:
push
-
Statement type: