Swagger UI bundled for usage with Python
Project description
swagger-ui-bundle-v2
Forked from spec-first/swagger_ui_bundle. We maintain this fork to keep the bundled Swagger UI up to date with newer releases.
This package contains the static files for swagger-ui as a python package.
Basic configuration options are templated with the Jinja2 templating language.
This package is intended to be webserver-agnostic, so it only includes the static files, and some very basic configuration.
Getting Started
You can import the swagger_ui_path from the swagger_ui_bundle package like so:
from swagger_ui_bundle import swagger_ui_path
You can easily serve up this directory as all static files to get the default swagger-ui distribution. Here’s an example in flask:
from swagger_ui_bundle import swagger_ui_path
from flask import Flask, Blueprint, send_from_directory, render_template
swagger_bp = Blueprint(
'swagger_ui',
__name__,
static_url_path='',
static_folder=swagger_ui_path,
template_folder=swagger_ui_path
)
app = Flask(__name__, static_url_path='')
app.register_blueprint(swagger_bp, url_prefix='/ui')
if __name__ == "__main__":
app.run()
You may wish to override some of the configuration variables. Included is a jinaj2 templated file where you can modify these parameters. You can add another route to render this template with your desired configuration like so:
SWAGGER_UI_CONFIG = {
"openapi_spec_url": "https://petstore.swagger.io/v2/swagger.json"
}
@swagger_bp.route('/')
def swagger_ui_index():
return render_template('index.j2', **SWAGGER_UI_CONFIG)
Have a look at example.py for a complete server for the Flask webserver.
Publishing
Test PyPI (tag = X.Y.Z, no v):
git tag 1.0.0 git push origin 1.0.0 pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ swagger-ui-bundle-v2
Production: tag + push, then GitHub Releases → Create release for that tag → Publish.:
git tag 1.0.0 git push origin 1.0.0 pip install swagger-ui-bundle-v2
License
Since this is just repackaging swagger-ui releases, the license comes from the swagger ui project (https://github.com/swagger-api/swagger-ui).
All vendored code is published under the Apache 2.0 License.
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_ui_bundle_v2-5.31.0.tar.gz.
File metadata
- Download URL: swagger_ui_bundle_v2-5.31.0.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5dfdb6c959f492ed56073a434c9485efa681a3b322704351a188ff41e1f284b
|
|
| MD5 |
6e02cd9d3c6b70d5402d60e0ae14b68d
|
|
| BLAKE2b-256 |
4c58e9e781e2e02c4ef65efe4996c87cafe46c79a1d554d417326db20e4e675f
|
Provenance
The following attestation bundles were made for swagger_ui_bundle_v2-5.31.0.tar.gz:
Publisher:
release.yml on cristhianclx/swagger-ui-bundle-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swagger_ui_bundle_v2-5.31.0.tar.gz -
Subject digest:
e5dfdb6c959f492ed56073a434c9485efa681a3b322704351a188ff41e1f284b - Sigstore transparency entry: 891478873
- Sigstore integration time:
-
Permalink:
cristhianclx/swagger-ui-bundle-v2@bf13b9acc59e88709858c741ac6696a12486688e -
Branch / Tag:
refs/tags/5.31.0 - Owner: https://github.com/cristhianclx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf13b9acc59e88709858c741ac6696a12486688e -
Trigger Event:
release
-
Statement type:
File details
Details for the file swagger_ui_bundle_v2-5.31.0-py3-none-any.whl.
File metadata
- Download URL: swagger_ui_bundle_v2-5.31.0-py3-none-any.whl
- Upload date:
- Size: 3.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad8484399c8da2868db86080bcd89bd3209d8efb69159a2c0145766da8968112
|
|
| MD5 |
2ff77afb1d930cfd4ca24d20b8327d48
|
|
| BLAKE2b-256 |
d91fddf472398c962efa27cbbe272b2b83b191e84c030e16d51e8923885f6b5c
|
Provenance
The following attestation bundles were made for swagger_ui_bundle_v2-5.31.0-py3-none-any.whl:
Publisher:
release.yml on cristhianclx/swagger-ui-bundle-v2
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
swagger_ui_bundle_v2-5.31.0-py3-none-any.whl -
Subject digest:
ad8484399c8da2868db86080bcd89bd3209d8efb69159a2c0145766da8968112 - Sigstore transparency entry: 891478940
- Sigstore integration time:
-
Permalink:
cristhianclx/swagger-ui-bundle-v2@bf13b9acc59e88709858c741ac6696a12486688e -
Branch / Tag:
refs/tags/5.31.0 - Owner: https://github.com/cristhianclx
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@bf13b9acc59e88709858c741ac6696a12486688e -
Trigger Event:
release
-
Statement type: