Additional extensions and utilities for drf-spectacular.
Project description
Additional extensions and utilities for drf-spectacular.
Features
🚀 Additional API Documentation UIs
Scalar UI Integration - Modern, interactive API documentation with Scalar
Easy integration with existing drf-spectacular setups
Customizable UI settings and themes
🔧 Enhanced Utilities
Extended configuration options for API documentation
Additional view classes and mixins
Better developer experience tools
Installation
pip install drf-spectacular-extras
Quick Start
Add drf_spectacular_extras to your INSTALLED_APPS:
INSTALLED_APPS = [
# ...
'drf_spectacular',
'drf_spectacular_extras',
# ...
]
Configure the Scalar UI (optional):
SPECTACULAR_EXTRAS_SETTINGS = {
'SCALAR_UI_SETTINGS': {
'theme': 'purple',
'layout': 'modern',
# Add any Scalar configuration options
},
}
Add Scalar UI to your URLs:
from drf_spectacular_extras.views import SpectacularScalarView
urlpatterns = [
# Your existing spectacular URLs
path('api/schema/', SpectacularAPIView.as_view(), name='schema'),
# Add Scalar UI
path('api/schema/scalar/',
SpectacularScalarView.as_view(url_name='schema'),
name='scalar'),
]
Visit /api/schema/scalar/ to see your API documentation with Scalar UI! 🎉
Configuration
Scalar UI Settings
You can customize the Scalar UI by configuring SPECTACULAR_EXTRAS_SETTINGS:
SPECTACULAR_EXTRAS_SETTINGS = {
'SCALAR_UI_SETTINGS': {
'theme': 'purple', # Theme: 'default', 'purple', 'blue', etc.
'layout': 'modern', # Layout style
'showSidebar': True, # Show/hide sidebar
'hideDownloadButton': False, # Hide download button
'searchHotKey': 'k', # Search hotkey
# See Scalar docs for all available options
},
'SCALAR_DIST': 'https://cdn.jsdelivr.net/npm/@scalar/api-reference@latest',
}
Requirements
Python 3.10+
Django 4.2+
djangorestframework 3.14+
drf-spectacular 0.28.0+
Why DRF Spectacular Extras?
While drf-spectacular provides excellent OpenAPI 3 schema generation and comes with Swagger UI and ReDoc, this package extends it with:
Modern UI Options: Access to cutting-edge documentation UIs like Scalar
Enhanced Developer Experience: Additional utilities and configuration options
Easy Integration: Drop-in compatibility with existing drf-spectacular setups
Active Maintenance: Regular updates to support the latest UI frameworks
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development setup:
git clone https://github.com/huynguyengl99/drf-spectacular-extras.git
cd drf-spectacular-extras
uv sync --all-extras
docker compose up # Start test database
python sandbox/manage.py migrate
python sandbox/manage.py runserver
Documentation
Please visit DRF Spectacular Extras docs for complete documentation.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Built on top of the excellent drf-spectacular package
Scalar UI integration powered by Scalar
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file drf_spectacular_extras-0.1.0.tar.gz.
File metadata
- Download URL: drf_spectacular_extras-0.1.0.tar.gz
- Upload date:
- Size: 6.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
127efcb9be393e0ad710a3657554ec059f8ad62e281a435ea45917b58d06b52a
|
|
| MD5 |
0e6ce9ee0635ab1d715f05f9d24028ad
|
|
| BLAKE2b-256 |
636c69eca8511dac17ab21c89c98ad3cbc015b97cd9939105d67017226f1df81
|
Provenance
The following attestation bundles were made for drf_spectacular_extras-0.1.0.tar.gz:
Publisher:
publish.yml on huynguyengl99/drf-spectacular-extras
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_spectacular_extras-0.1.0.tar.gz -
Subject digest:
127efcb9be393e0ad710a3657554ec059f8ad62e281a435ea45917b58d06b52a - Sigstore transparency entry: 238621548
- Sigstore integration time:
-
Permalink:
huynguyengl99/drf-spectacular-extras@9892f1a3e3be1669dae6d6097dea28f484bd5976 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/huynguyengl99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9892f1a3e3be1669dae6d6097dea28f484bd5976 -
Trigger Event:
push
-
Statement type:
File details
Details for the file drf_spectacular_extras-0.1.0-py3-none-any.whl.
File metadata
- Download URL: drf_spectacular_extras-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
806e329182eb8237de90222e00ca4f5d521c2b4d50f7f73a1064b71140fe67f6
|
|
| MD5 |
d49e0cdb4b783cbba4d930c623e83b2e
|
|
| BLAKE2b-256 |
b412154cfa9cd3c811a79e041aaefcfa49020870486857a8b0cacef07ec014c2
|
Provenance
The following attestation bundles were made for drf_spectacular_extras-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on huynguyengl99/drf-spectacular-extras
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
drf_spectacular_extras-0.1.0-py3-none-any.whl -
Subject digest:
806e329182eb8237de90222e00ca4f5d521c2b4d50f7f73a1064b71140fe67f6 - Sigstore transparency entry: 238621551
- Sigstore integration time:
-
Permalink:
huynguyengl99/drf-spectacular-extras@9892f1a3e3be1669dae6d6097dea28f484bd5976 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/huynguyengl99
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9892f1a3e3be1669dae6d6097dea28f484bd5976 -
Trigger Event:
push
-
Statement type: