swagger-ui-py
Swagger UI for Python web framework, such as Tornado, Flask, Quart, Sanic and Falcon.
What it is and what it does
Swagger-ui-py is a bridge that adds interactive Swagger UI documentation to Python web applications. It works with a wide range of frameworks—Flask, Tornado, Sanic, aiohttp, Quart, Starlette, Falcon, Bottle, and Chalice—by injecting a documentation endpoint that serves the Swagger UI interface. You provide an OpenAPI/Swagger specification (as a local YAML/JSON file, a remote URL, a Python dict, or a JSON string), and the package renders it as an interactive, browsable API explorer at a URL you choose.
The package depends on jinja2 for templating, packaging for version handling, and PyYaml for configuration parsing. It bundles Swagger UI v5.25.3 and Swagger Editor v4.14.6, allowing both read-only documentation viewing and optional in-browser editing of your API spec. Configuration is straightforward: a single function call with your app instance and spec source, plus optional parameters for Swagger UI behavior and OAuth2 settings.
Use it for:
- Add interactive API documentation to a Flask or Tornado REST API without writing HTML or maintaining separate docs.
- Serve Swagger UI from a local OpenAPI spec file in a multi-framework Python web application.
- Enable in-browser editing of your API specification with the built-in Swagger Editor.
- Integrate OAuth2 configuration into your API docs for testing authenticated endpoints.
- Support multiple Python web frameworks with a single documentation integration pattern.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Swagger UI documentation into Python web frameworks (Flask, Tornado, Sanic, aiohttp, Quart, Starlette, Falcon, Bottle, Chalice) to serve interactive API documentation from OpenAPI/Swagger specifications.
Yes, if you need to add Swagger UI documentation to a Python web application. The package is straightforward to integrate, has low install friction, carries no known vulnerabilities, and works across many popular frameworks. The aging maintenance status (409 days since last release) is a minor concern but not a blocker—the repository is still active and the functionality is stable. Install it when you want interactive API docs without building custom documentation infrastructure.
Install
swagger-ui-py on PyPI
pip
pip install swagger-ui-pyuv
uv add swagger-ui-pypoetry
poetry add swagger-ui-pyInstalling swagger-ui-py
Before you install
Low install friction with three lightweight runtime dependencies (jinja2, packaging, PyYaml). Maintenance status is aging—last release was 409 days ago—but the repository remains active and unarchived with recent commits.
License in practice
Licensed under Apache License 2.0 (permissive), allowing commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install swagger-ui-py
from swagger_ui import api_doc
api_doc(app, config_path='./config/test.yaml', url_prefix='/api/doc', title='API doc')
Requires Python 3.0 or later; your web framework (Flask, Tornado, etc.) must be installed separately.
Verify before relying
- Whether the 409-day gap since last release signals maintenance concerns or stable maturity for this use case.
- Performance characteristics when serving large or complex OpenAPI specifications.
- Compatibility with the latest versions of supported frameworks (Flask, Tornado, Sanic, etc.).
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | supports the current Python release (>=3.0.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — jinja2, packaging, PyYaml |
| Maintenance | aging — 409 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 146,696/month — #11,091 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: swagger_ui_py-25.7.1-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
aiohttp-swaggerGenerates Swagger API documentation and…
permissive · top 15,000 on PyPI
flask-swagger-uiAdds Swagger UI to Flask applications as a…
permissive · top 5,000 on PyPI
swagger-ui-bundlePackages Swagger UI's static files and…
permissive · top 5,000 on PyPI
tapipyTapipy is a Python SDK that automatically…
permissive · top 15,000 on PyPI
swagger-plugin-for-sphinxA Sphinx plugin that embeds interactive Swagger…
permissive · top 5,000 on PyPI
flask-swaggerExtracts Swagger 2.0 API specifications from…
permissive · top 15,000 on PyPI
mkdocs-swagger-ui-tagA MkDocs plugin that embeds Swagger UI directly…
permissive · top 15,000 on PyPI
flask-openapi3-swaggerProvides Swagger UI integration for…
permissive · top 15,000 on PyPI
mkdocs-render-swagger-pluginRenders Swagger and OpenAPI schemas as…
permissive · top 15,000 on PyPI
apispec-webframeworksProvides web framework plugins for apispec to…
permissive · top 15,000 on PyPI