swagger_ui_bundle
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.
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.
Release files for swagger-ui-bundle 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| swagger_ui_bundle-1.1.0.tar.gz | 2.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| swagger_ui_bundle-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.2 MB
Release files / swagger_ui_bundle-1.1.0.tar.gz
| Download URL | swagger_ui_bundle-1.1.0.tar.gz |
|---|---|
| Size | 2.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20673c3431c8733d5d1615ecf79d9acf30cff75202acaf21a7d9c7f489714529
|
|
BLAKE2b-256 checksum How to use checksums |
01e6d8ae21087a42627c2a04a738c947825b78c26b18595704b94bd3227197a2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.1 CPython/3.11.6
|
Release files / swagger_ui_bundle-1.1.0-py3-none-any.whl
| Download URL | swagger_ui_bundle-1.1.0-py3-none-any.whl |
|---|---|
| Size | 2.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f7526f7bb99923e10594c54247265839bec97e96b0438561ac86faf40d40dd57
|
|
BLAKE2b-256 checksum How to use checksums |
a2668fb11445940bde7ca328d6aa23dd36b6056197d862f4bd6bb51c820c50e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/4.0.1 CPython/3.11.6
|