Sphinx plugin which renders a OpenAPI specification with Swagger
Project description
Swagger Plugin for Sphinx
This is a handy plugin to bring Swagger and Sphinx together.
It can generate one or multiple swagger HTML pages with a custom configuration that hosts an OpenAPI specification.
Install
Just run pip install swagger-plugin-for-sphinx
Usage
Enable the Plugin
First, add the plugin to the extensions list:
extensions = ["swagger_plugin_for_sphinx"]
Global Configuration
Swagger uses two JavaScript and one CSS file to render the output.
These can be set in conf.py:
swagger_present_uri = ""
swagger_bundle_uri = ""
swagger_css_uri = ""
These correspond to the modules explained here. By default, the latest release is used from here.
Directive
To include a Swagger API specification into an HTML page specify the swagger-plugin directive
and the relative path to the specification:
.. swagger-plugin:: path/to/spec.yaml
The spec is automatically copied into the _static build output directory.
The directive supports the following options
id: specifies an unique ID for the specification per page (see below)full-page: if set, all other content on the page is dropped and only the Swagger part is renderedpage-title: the name of the HTML page iffull-pageis specifiedswagger-options: JSON string that is passed to Swagger to enable additional options as described on the configuration page of the Swagger documentation.
By default, the directive creates a <div> element with the ID swagger-ui-container.
If you put more than one swagger-plugin directive in a file, specify unique IDs:
.. swagger-plugin:: path/to/one.yaml
:id: spec-one
.. swagger-plugin:: path/to/two.yaml
:id: spec-two
Development
This project uses uv.
To setup a venv for development use
python3.14 -m venv venv && pip install uv && uv sync --all-groups && rm -rf venv/.
Then use source .venv/bin/activate to activate your venv.
Build and Publish
This project uses setuptools as the dependency management and build tool.
To publish a new release, follow these steps:
- Update the version in the
pyproject.toml - Add an entry in the changelog
- Push a new tag like
vX.X.Xto trigger the release
Support, Feedback, Contributing
This project is open to feature requests/suggestions, bug reports etc., via GitHub issues. Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our Contribution Guidelines.
Code of Conduct
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its Code of Conduct at all times.
Licensing
Copyright 2025 SAP SE or an SAP affiliate company and swagger-plugin-for-sphinx contributors. Please see our LICENSE for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available via the REUSE tool.
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 swagger_plugin_for_sphinx-6.1.0.tar.gz.
File metadata
- Download URL: swagger_plugin_for_sphinx-6.1.0.tar.gz
- Upload date:
- Size: 16.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa523d9eb4538f0e26306359e3b9ca59b8f2923c56fe8b47ac3c6de63f13e4e
|
|
| MD5 |
3ae47fb174c88fa25220143ce5c44e5e
|
|
| BLAKE2b-256 |
c5f6f614ba9486177528e954751bf1f7dc481c7f8c061134b33a78a22f549dcb
|
Provenance
The following attestation bundles were made for swagger_plugin_for_sphinx-6.1.0.tar.gz:
Publisher:
release.yml on SAP/swagger-plugin-for-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swagger_plugin_for_sphinx-6.1.0.tar.gz -
Subject digest:
baa523d9eb4538f0e26306359e3b9ca59b8f2923c56fe8b47ac3c6de63f13e4e - Sigstore transparency entry: 732294886
- Sigstore integration time:
-
Permalink:
SAP/swagger-plugin-for-sphinx@285889e9b3da93787edbcdf7e0332a286755732c -
Branch / Tag:
refs/tags/v6.1.0 - Owner: https://github.com/SAP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@285889e9b3da93787edbcdf7e0332a286755732c -
Trigger Event:
push
-
Statement type:
File details
Details for the file swagger_plugin_for_sphinx-6.1.0-py3-none-any.whl.
File metadata
- Download URL: swagger_plugin_for_sphinx-6.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c49651f31a48e8625be863ff345abd6a28a7b78c58ea2ea51daa736dbe9eb37f
|
|
| MD5 |
27df27608a45993ee37330ea6da6817e
|
|
| BLAKE2b-256 |
e2aa486371aca5eee1f79336d9c42c73ec62061eb7d084f77b4e2e361a06e5e6
|
Provenance
The following attestation bundles were made for swagger_plugin_for_sphinx-6.1.0-py3-none-any.whl:
Publisher:
release.yml on SAP/swagger-plugin-for-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swagger_plugin_for_sphinx-6.1.0-py3-none-any.whl -
Subject digest:
c49651f31a48e8625be863ff345abd6a28a7b78c58ea2ea51daa736dbe9eb37f - Sigstore transparency entry: 732294887
- Sigstore integration time:
-
Permalink:
SAP/swagger-plugin-for-sphinx@285889e9b3da93787edbcdf7e0332a286755732c -
Branch / Tag:
refs/tags/v6.1.0 - Owner: https://github.com/SAP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@285889e9b3da93787edbcdf7e0332a286755732c -
Trigger Event:
push
-
Statement type: