Skip to main content

Additional extensions and utilities for drf-spectacular.

Project description

PyPI Code Coverage Test

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

  1. Add drf_spectacular_extras to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'drf_spectacular',
    'drf_spectacular_extras',
    # ...
]
  1. Configure the Scalar UI (optional):

SPECTACULAR_EXTRAS_SETTINGS = {
    'SCALAR_UI_SETTINGS': {
        'theme': 'purple',
        'layout': 'modern',
        # Add any Scalar configuration options
    },
}
  1. 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'),
]
  1. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

drf_spectacular_extras-0.1.0.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

drf_spectacular_extras-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

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

Hashes for drf_spectacular_extras-0.1.0.tar.gz
Algorithm Hash digest
SHA256 127efcb9be393e0ad710a3657554ec059f8ad62e281a435ea45917b58d06b52a
MD5 0e6ce9ee0635ab1d715f05f9d24028ad
BLAKE2b-256 636c69eca8511dac17ab21c89c98ad3cbc015b97cd9939105d67017226f1df81

See more details on using hashes here.

Provenance

The following attestation bundles were made for drf_spectacular_extras-0.1.0.tar.gz:

Publisher: publish.yml on huynguyengl99/drf-spectacular-extras

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file drf_spectacular_extras-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for drf_spectacular_extras-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 806e329182eb8237de90222e00ca4f5d521c2b4d50f7f73a1064b71140fe67f6
MD5 d49e0cdb4b783cbba4d930c623e83b2e
BLAKE2b-256 b412154cfa9cd3c811a79e041aaefcfa49020870486857a8b0cacef07ec014c2

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page