Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,6 @@ venv/
*.egg-info/
MANIFEST

!/drf_spectacular_sidecar/static/drf_spectacular_sidecar/@scalar/api-reference/*

!.gitignore
7 changes: 5 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ drf-spectacular-sidecar

|pypi-version| |pypi-dl|

Serve self-contained distribution builds of `Swagger UI`_ and `Redoc`_ with `Django`_ either via `runserver`_ or `collectstatic`_.
Serve self-contained distribution builds of `Swagger UI`_, `Redoc`_, and `Scalar`_ with `Django`_ either via `runserver`_ or `collectstatic`_.

This Django app is an optional addition to `drf-spectacular`_, but does not depend on it. It may also be used independently.

* `Swagger UI`_ version ``5.22.0`` (`npm <https://www.npmjs.com/package/swagger-ui-dist>`__)
* `Swagger UI`_ version ``5.24.1`` (`npm <https://www.npmjs.com/package/swagger-ui-dist>`__)
* `Redoc`_ version ``2.5.0`` (`npm <https://www.npmjs.com/package/redoc>`__)
* `Scalar`_ version ``1.31.11`` (`npm <https://www.npmjs.com/package/@scalar/api-reference>`__)

This is a self-updating and self-publishing repository that looks for updates on the 1st of every month.
The distribution files are sourced from npm via `jsdelivr`_, validated, packaged and uploaded to `PyPI`_.
Expand Down Expand Up @@ -44,6 +45,7 @@ This package includes distribution builds of

* `Swagger UI`_: The `original license (Apache 2.0) <https://github.com/swagger-api/swagger-ui/blob/master/LICENSE>`_ and copyright apply to those files.
* `Redoc`_: The `original license (MIT) <https://github.com/Redocly/redoc/blob/master/LICENSE>`_ and copyright apply to those files.
* `Scalar`_: The `original license (MIT) <https://github.com/scalar/scalar/blob/main/LICENSE>`_ and copyright apply to those files.


.. |pypi-version| image:: https://img.shields.io/pypi/v/drf-spectacular-sidecar.svg
Expand All @@ -57,5 +59,6 @@ This package includes distribution builds of
.. _drf-spectacular: https://github.com/tfranzel/drf-spectacular
.. _Redoc: https://github.com/Redocly/redoc
.. _Swagger UI: https://github.com/swagger-api/swagger-ui
.. _Scalar: https://github.com/scalar/scalar
.. _collectstatic: https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#collectstatic
.. _runserver: https://docs.djangoproject.com/en/3.2/ref/contrib/staticfiles/#runserver
3 changes: 2 additions & 1 deletion distributions.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"redoc": "2.5.0",
"swagger-ui-dist": "5.22.0"
"@scalar/api-reference": "1.31.11",
"swagger-ui-dist": "5.24.1"
}
2 changes: 1 addition & 1 deletion drf_spectacular_sidecar/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import django

__version__ = '2025.6.1'
__version__ = '2025.6.14'

if django.VERSION < (3, 2):
default_app_config = 'drf_spectacular_sidecar.apps.SpectacularSidecarConfig'
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023-present Scalar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion update.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from packaging.version import parse as vp

from update_assets import update_redoc, update_swagger_ui
from update_assets import update_redoc, update_scalar, update_swagger_ui

PACKAGE = 'drf_spectacular_sidecar'

Expand Down Expand Up @@ -39,10 +39,12 @@ def update_config(name, value):
def main():
old_redoc_version, new_redoc_version = update_redoc()
old_swagger_ui_version, new_swagger_ui_version = update_swagger_ui()
old_scalar_version, new_scalar_version = update_scalar()

if (
not new_redoc_version
and not new_swagger_ui_version
and not new_scalar_version
and not get_config('hotfix_required')
):
print('no updates available')
Expand Down Expand Up @@ -71,6 +73,11 @@ def main():
file="README.rst",
func=lambda l: l.replace(old_swagger_ui_version, new_swagger_ui_version),
)
if new_scalar_version:
update_file(
file="README.rst",
func=lambda l: l.replace(old_scalar_version, new_scalar_version),
)

if os.environ.get("CI"):
run_or_fail("git config user.name github-actions")
Expand Down
8 changes: 8 additions & 0 deletions update_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
"swagger-ui.css",
"swagger-ui.css.map",
"favicon-32x32.png",
],
"@scalar/api-reference": [
"dist/browser/standalone.js",
]
}

Expand Down Expand Up @@ -106,3 +109,8 @@ def update_swagger_ui() -> tuple[str, Optional[str]]:
expected_hash=None
)
return old_version, new_version


def update_scalar() -> tuple[str, Optional[str]]:
old_version = _CURRENT_VERSIONS["@scalar/api-reference"]
return old_version, update_dist(package="@scalar/api-reference", tag="latest")