skillfed

sanic-ext

Extend your Sanic installation with some core functionality.

sanic-ext v25.12.0 720.6K downloads/30d#5,234 on PyPI66
Permissive license MIT AGING released

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-ext

uv

uv add sanic-ext

poetry

poetry add sanic-ext

Installing 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

Development Status :: 4 - BetaEnvironment :: Web EnvironmentLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

sanic openapi documentationsanic request validationsanic cors middlewaresanic swagger redocsanic argument injectionsanic extensions pluginsanic rest api tools
sanic-pluginopenapi-documentationrest-api

More Application Frameworks packages