drf-spectacular
Sane and flexible OpenAPI 3 schema generation for Django REST framework
Decision gist · record as of 2026-08-14
Yes. drf-spectacular is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It solves a real problem—generating accurate OpenAPI documentation from Django REST framework code—and is widely used (top 5000 PyPI packages). Install it if you need OpenAPI schemas for a DRF API and want automation over manual maintenance.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Django 3.2+ and Django REST Framework 3.12+; Python >= 3.8.
- Low friction install with a pure-Python wheel.
- Actively maintained with a recent release (39 days ago) and 2851 repository stars.
License · maintenance · safety
BSD-3-Clause (permissive) — Licensed under BSD-3-Clause (permissive), allowing commercial and private use with minimal restrictions—only requiring license and copyright notice inclusion.
last release 2026-07-06 (39 days) · last repo commit 2026-08-10 · 2,851 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 13,905,521 downloads/mo, #1,258 on PyPI
Alternatives
Verify before relying
pip install drf-spectacular
# In settings.py
INSTALLED_APPS = ['drf_spectacular']
REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema'}
# In urls.py
from drf_spectacular.views import SpectacularAPIView
urlpatterns = [path('api/schema/', SpectacularAPIView.as_view(), name='schema')]- Whether the package's schema generation works correctly with all listed framework versions without manual intervention.
- Performance characteristics when generating schemas for large or deeply nested API structures.
- Compatibility with third-party DRF extensions beyond those explicitly listed in the description.
What it is and what it does
drf-spectacular is an OpenAPI schema generator for Django REST framework that extracts API structure directly from your code and produces valid OpenAPI 3.0.3, 3.1, or 3.2 specifications. It replaces the basic schema generation built into DRF with a more capable alternative that handles real-world API patterns: nested and recursive serializers, polymorphic responses, custom authentication schemes, and vendor extensions. The package works out of the box with sensible defaults but offers deep customization through the @extend_schema decorator and settings, allowing you to override serializers, add examples, control operation IDs, and adjust how components are split.
The tool integrates with popular DRF extensions (SimpleJWT, django-filter, Pydantic, django-polymorphic) and provides built-in views to serve the schema via Swagger UI or Redoc. You can generate schemas via CLI (./manage.py spectacular) or serve them live from your API. It depends on Django, djangorestframework, uritemplate, PyYAML, jsonschema, inflection, and typing-extensions—all lightweight, widely-used libraries.
Use it for
- Generate and serve interactive API documentation (Swagger UI or Redoc) directly from your Django REST framework code.
- Export OpenAPI schemas for use with code generators (client SDKs, mock servers) or third-party API tools.
- Document complex APIs with nested serializers, polymorphic responses, and custom authentication without manual schema writing.
- Validate API schemas during CI/CD pipelines using the --validate CLI flag.
- Customize schema output per-endpoint using @extend_schema decorators to override auto-detected types or add examples.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
drf-spectacular is actively maintained, has no known vulnerabilities, installs with low friction, and is licensed permissively. It solves a real problem—generating accurate OpenAPI documentation from Django REST framework code—and is widely used (top 5000 PyPI packages). Install it if you need OpenAPI schemas for a DRF API and want automation over manual maintenance.
Install
drf-spectacular on PyPI
Before you install
Low friction install with a pure-Python wheel. Actively maintained with a recent release (39 days ago) and 2851 repository stars. Depends on Django, djangorestframework, and several lightweight utilities (uritemplate, PyYAML, jsonschema, inflection, typing-extensions).
Requires Django 3.2+ and Django REST Framework 3.12+; Python >= 3.8.
License in practice
Licensed under BSD-3-Clause (permissive), allowing commercial and private use with minimal restrictions—only requiring license and copyright notice inclusion.
Quickstart
pip install drf-spectacular
# In settings.py
INSTALLED_APPS = ['drf_spectacular']
REST_FRAMEWORK = {'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema'}
# In urls.py
from drf_spectacular.views import SpectacularAPIView
urlpatterns = [path('api/schema/', SpectacularAPIView.as_view(), name='schema')]
Verify before relying
- Whether the package's schema generation works correctly with all listed framework versions without manual intervention.
- Performance characteristics when generating schemas for large or deeply nested API structures.
- Compatibility with third-party DRF extensions beyond those explicitly listed in the description.
Package facts
| License | BSD-3-Clause permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 7 packagesDjangodjangorestframeworkuritemplatePyYAMLjsonschemainflectiontyping-extensions |
| Maintenance | Actively maintained 39 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 13,905,521 / month, #1,258 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 2.2Framework :: Django :: 3.2Framework :: Django :: 4.0Framework :: Django :: 4.1Framework :: Django :: 4.2Framework :: Django :: 5.0Framework :: Django :: 5.1Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: DocumentationTopic :: Internet :: WWW/HTTPTopic :: Software Development :: Code Generators |
Evidence: drf_spectacular-0.30.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “rest framework openapi”
- drf-spectacularGenerates OpenAPI 3.0.3, 3.1, and 3.2 schemas automatically from…
- drf-spectacular-jsonapiGenerates OpenAPI 3 schemas for Django REST Framework APIs that use…
- django-rest-swaggerGenerates Swagger UI documentation and OpenAPI JSON schemas for…
Give your agent the search over MCP, or paste the wish link into any chat.
More WWW/HTTP packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
h11 is a pure-Python HTTP/1.1 protocol implementation that handles parsing and serializing HTTP messages without any built-in I/O, letting you integrate it with any network layer you choose.
HTTPX is a fully featured HTTP client library for Python that provides both sync and async APIs, with support for HTTP/1.1 and HTTP/2, plus an integrated command-line client.
Install it if you are building new projects or modernizing existing ones that rely on HTTP.
A minimal low-level HTTP client library that sends HTTP requests with thread-safe and task-safe connection pooling, supporting HTTP/1.1, HTTP/2, proxies, and both sync and async interfaces.
aiohttp is an async HTTP client and server framework built on asyncio, supporting both WebSockets and middleware-based routing for building concurrent web applications.
Install it if you need async HTTP client or server capabilities in asyncio-based applications.
See also drf-spectacular-jsonapi · drf-spectacular-sidecar · drf-yasg · drf-standardized-errors · flask-openapi3 · mkdocs-render-swagger-plugin · voluptuous-openapi · djangorestframework · flask-openapi3-swagger · drf-jsonschema-serializer