py_swagger_ui
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 py_swagger_ui package like so:
from py_swagger_ui 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 py_swagger_ui 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.
Metadata
Release files for py-swagger-ui 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 | Provenance | Actions |
|---|---|---|---|---|
| py_swagger_ui-1.1.0.tar.gz | 7.5 MB | Without provenance | Details for py_swagger_ui-1.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_swagger_ui-1.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_swagger_ui-1.1.0-py3-none-any.whl |
Total release size: 15.0 MB
Release files / py_swagger_ui-1.1.0.tar.gz
| Download URL | py_swagger_ui-1.1.0.tar.gz |
|---|---|
| Size | 7.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2660e53f130c2093fd29eaa1ea07fcf2a832a15914abf865de493da5b97926d
|
|
BLAKE2b-256 checksum How to use checksums |
9294c2484ced144c2dd48d7939b30762ff11f9b9311db0f6f877217d4163203e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / py_swagger_ui-1.1.0-py3-none-any.whl
| Download URL | py_swagger_ui-1.1.0-py3-none-any.whl |
|---|---|
| Size | 7.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0e6703e8834b2d412cf48d8065dcf1f6fa865e41142dca5a51e9b2060050a3b9
|
|
BLAKE2b-256 checksum How to use checksums |
2120040f4f715bca4f2efcbe415d65e29e661b4a18badb5ac4e0773f7500f80a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for py-swagger-ui 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.