Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.1.8 instead.
Reason given by maintainers: Broken initial build, please use 0.1.7+

aiohttp-autodocs

A zero-overhead, non-invasive OpenAPI 3.1.0 documentation generator for aiohttp.

It gives you the beautiful Swagger UI and Pydantic integration of modern frameworks (like FastAPI), but preserves the raw, unhindered speed and stability of bare aiohttp.

Design Philosophy

This package was built with a specific set of architectural goals in mind to ensure it remains safe and performant in production environments:

  1. Absolute Zero Runtime Overhead Many OpenAPI solutions intercept every HTTP request at runtime to perform validation and dependency injection, adding CPU overhead to every API call. aiohttp-autodocs operates entirely at boot time. It builds the OpenAPI spec once, freezes it to raw bytes in memory, and steps out of the way. When a user hits an endpoint, the decorator does absolutely nothing.

  2. Native Pydantic v2 Support If your project uses modern pydantic (or sqlmodel), you shouldn't have to rewrite your schemas into another validation library just to generate documentation. Our package natively understands Pydantic v2 (including nested $defs), while degrading gracefully to raw Python dictionaries if Pydantic isn't installed.

  3. Non-Invasive Architecture We don't force you to use Class-Based Views or wrap your handlers so heavily that you lose access to the raw web.Request object. Your routes remain pure aiohttp async functions.

  4. No YAML-in-Docstrings Older tools rely on writing OpenAPI YAML directly inside your Python function docstrings. This is error-prone, hard to format, and invisible to IDE type-checkers. We use a strongly typed Python decorator (@docs()) so your IDE catches mistakes instantly.

Installation

# If you want Pydantic support
pip install aiohttp-autodocs[pydantic]

# If you only want raw dictionary schemas
pip install aiohttp-autodocs

Quick Start

1. Decorate your routes

The @docs decorator attaches metadata to your handler. It must be placed above the aiohttp route decorator.

from aiohttp import web
from aiohttp_autodocs import docs
from pydantic import BaseModel

class AlarmSchema(BaseModel):
    id: int
    message: str

alarm_routes = web.RouteTableDef()

@docs(
    summary="List all alarms",
    tags=["Alarms"],
    response=AlarmSchema,
    response_list=True,
    security=["BearerAuth"]
)
@alarm_routes.get("/api/v1/alarms")
async def get_alarms(request: web.Request) -> web.Response:
    return web.json_response([{"id": 1, "message": "High CPU"}])

2. Build the spec at startup

In your application factory (e.g., create_app()), call build_openapi after you've added all your routes.

from aiohttp_autodocs import build_openapi, OpenAPIConfig

app = web.Application()
app.add_routes(alarm_routes)

build_openapi(
    app,
    OpenAPIConfig(
        title="My API",
        version="1.0.0",
        enabled=True,
        security_schemes={
            "BearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "bearerFormat": "JWT",
            }
        }
    ),
    alarm_routes  # Pass all your RouteTableDefs here
)

web.run_app(app)

3. View your docs

Start your server and visit:

  • Interactive Swagger UI: http://localhost:8080/docs
  • Raw OpenAPI JSON: http://localhost:8080/openapi.json

Contributing

Please see CONTRIBUTING.md for development setup (uv), testing, and workflow guidelines.

Download files

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

Source Distribution

aiohttp_autodocs-0.1.5.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

aiohttp_autodocs-0.1.5-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file aiohttp_autodocs-0.1.5.tar.gz.

File metadata

  • Download URL: aiohttp_autodocs-0.1.5.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for aiohttp_autodocs-0.1.5.tar.gz
Algorithm Hash digest
SHA256 dd42833f1353edc14fbb7205f673058c2c3996ec6dddbd620ad552052cb8908f
MD5 5e62e8326108f0b73926861ba2c8c13c
BLAKE2b-256 e892e01dcdb3d490ec53083e7d504e8f520e65d2e75e05d50bc1c0c254bffbdc

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiohttp_autodocs-0.1.5.tar.gz:

Publisher: release.yml on kappall/aiohttp_autodocs

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

File details

Details for the file aiohttp_autodocs-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for aiohttp_autodocs-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 63b9e052833f878b3c90e451189b88a4bed2b9656c7b76721a59842c8f986f40
MD5 bceb51fc2b692428daa8301e894d35c7
BLAKE2b-256 b488a8ee82c137a0037e3245aa89250a8b722a68b2f04322443d1e8502f0271e

See more details on using hashes here.

Provenance

The following attestation bundles were made for aiohttp_autodocs-0.1.5-py3-none-any.whl:

Publisher: release.yml on kappall/aiohttp_autodocs

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

Release history Release notifications | RSS feed

0.1.8

2 files

0.1.7

2 files

This release

0.1.5 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page