sanic-ext
Extend your Sanic installation with some core functionality.
What it is and what it does
Sanic Extensions is an officially supported plugin for the Sanic web framework that layers additional developer conveniences on top of Sanic's unopinionated core. It provides OpenAPI documentation generation with Redoc and Swagger UI, request validation for query arguments and request bodies, CORS protection, automatic HEAD/OPTIONS/TRACE endpoint creation, and argument injection into route handlers. The package depends only on pyyaml and sanic itself, making it lightweight to add to an existing Sanic installation.
The extension is designed to work transparently—once installed, it automatically enhances a Sanic application without requiring major code changes. It targets developers who want Sanic's flexibility but also need common REST API features like schema validation and API documentation out of the box, without building those layers themselves.
Use it for:
- Generate OpenAPI documentation and interactive Swagger UI for a Sanic REST API without manual schema definition
- Validate incoming request query parameters and JSON body payloads against a schema before route handlers execute
- Add CORS headers and protection to a Sanic application serving cross-origin requests
- Automatically handle HTTP OPTIONS and HEAD requests for existing GET endpoints
- Inject validated request arguments directly into route handler function signatures
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sanic Extensions adds OpenAPI documentation, request validation, CORS, argument injection, and automatic HTTP method handling to Sanic web applications.
Yes, if you are already using Sanic and need OpenAPI documentation, request validation, or CORS support. The low install friction and permissive license make it a straightforward addition. However, the aging maintenance status (206 days since last release) and ALPHA-stage API designation in the description suggest caution for production use—verify current stability and whether the API has stabilized since the excerpt was written.
Install
sanic-ext on PyPI
pip
pip install sanic-extuv
uv add sanic-extpoetry
poetry add sanic-extInstalling sanic-ext
Before you install
Low install friction with just two runtime dependencies (pyyaml and sanic). Maintenance status is aging—last commit was 206 days ago—but the repository remains active and not archived, suggesting ongoing but infrequent updates.
License in practice
MIT license is permissive, allowing commercial use, modification, and distribution with minimal restrictions. No licensing concerns for most projects.
Quickstart
pip install sanic-ext
from sanic import Sanic
from sanic_ext import Extend
app = Sanic("MyApp")
Extend(app)
Verify before relying
- Whether automatic extension occurs without explicit Extend() call as description suggests
- Current stability status beyond 'ALPHA' designation in the excerpt
- Specific Python version requirements despite classifiers listing 3.10–3.14
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — pyyaml, sanic |
| Maintenance | aging — 206 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 720,624/month — #5,234 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sanic_ext-25.12.0-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
Sanic-CorsSanic-CORS is a Sanic extension that adds…
permissive · top 15,000 on PyPI
sanicSanic is an async Python web framework and…
permissive · top 5,000 on PyPI
aiohttp-swagger3Integrates OpenAPI 3 documentation and request…
permissive · top 15,000 on PyPI
sphinxcontrib-redocA Sphinx extension that embeds OpenAPI…
permissive · top 15,000 on PyPI
flask-pydantic-specAdds OpenAPI documentation generation and…
unclear · top 15,000 on PyPI
sanic-jwtSanic JWT adds JWT-based authentication and…
permissive · top 15,000 on PyPI
flask-openapi3-swaggerProvides Swagger UI integration for…
permissive · top 15,000 on PyPI
quart-schemaQuart-Schema adds schema validation and…
permissive · top 15,000 on PyPI
swagger-ui-pyIntegrates Swagger UI documentation into Python…
permissive · top 15,000 on PyPI
spectreeGenerates OpenAPI documents and validates HTTP…
permissive · top 15,000 on PyPI