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:
.. code-block:: python
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:
.. code-block:: python
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:
.. code-block:: python
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/spec-first/swagger_ui_bundle",
"name": "swagger-ui-bundle",
"maintainer": "Robbe Sneyders",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "robbe.sneyders@gmail.com",
"keywords": "swagger-ui",
"author": "Daniel Grossmann-Kavanagh",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/01/e6/d8ae21087a42627c2a04a738c947825b78c26b18595704b94bd3227197a2/swagger_ui_bundle-1.1.0.tar.gz",
"platform": null,
"description": "swagger_ui_bundle\n=================\nThis package contains the static files for swagger-ui as a python package.\n\nBasic configuration options are templated with the Jinja2 templating language.\n\nThis package is intended to be webserver-agnostic, so it only includes the\nstatic files, and some very basic configuration.\n\nGetting Started\n===============\nYou can import the swagger_ui_path from the swagger_ui_bundle package like so:\n\n.. code-block:: python\n \n from swagger_ui_bundle import swagger_ui_path\n\nYou can easily serve up this directory as all static files to get the default\nswagger-ui distribution. Here's an example in flask:\n\n.. code-block:: python\n\n from swagger_ui_bundle import swagger_ui_path\n \n from flask import Flask, Blueprint, send_from_directory, render_template\n \n swagger_bp = Blueprint(\n 'swagger_ui',\n __name__,\n static_url_path='',\n static_folder=swagger_ui_path,\n template_folder=swagger_ui_path\n )\n \n app = Flask(__name__, static_url_path='')\n app.register_blueprint(swagger_bp, url_prefix='/ui')\n \n if __name__ == \"__main__\":\n app.run()\n\nYou may wish to override some of the configuration variables. Included\nis a jinaj2 templated file where you can modify these parameters.\nYou can add another route to render this template with your\ndesired configuration like so:\n\n.. code-block:: python\n\n SWAGGER_UI_CONFIG = {\n \"openapi_spec_url\": \"https://petstore.swagger.io/v2/swagger.json\"\n }\n\n @swagger_bp.route('/')\n def swagger_ui_index():\n return render_template('index.j2', **SWAGGER_UI_CONFIG)\n\n\nHave a look at `example.py` for a complete server for the Flask webserver.\n\n\nLicense\n=======\nSince this is just repackaging swagger-ui releases, the license comes from\nthe swagger ui project (https://github.com/swagger-api/swagger-ui).\n\nAll vendored code is published under the Apache 2.0 License.\n\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Swagger UI bundled for usage with Python",
"version": "1.1.0",
"project_urls": {
"Homepage": "https://github.com/spec-first/swagger_ui_bundle",
"Repository": "https://github.com/spec-first/swagger_ui_bundle"
},
"split_keywords": [
"swagger-ui"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a2668fb11445940bde7ca328d6aa23dd36b6056197d862f4bd6bb51c820c50e5",
"md5": "7db5ae81d3f2beb0c58c7e9b50800f1e",
"sha256": "f7526f7bb99923e10594c54247265839bec97e96b0438561ac86faf40d40dd57"
},
"downloads": -1,
"filename": "swagger_ui_bundle-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7db5ae81d3f2beb0c58c7e9b50800f1e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 2626591,
"upload_time": "2023-11-01T19:58:15",
"upload_time_iso_8601": "2023-11-01T19:58:15.366905Z",
"url": "https://files.pythonhosted.org/packages/a2/66/8fb11445940bde7ca328d6aa23dd36b6056197d862f4bd6bb51c820c50e5/swagger_ui_bundle-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "01e6d8ae21087a42627c2a04a738c947825b78c26b18595704b94bd3227197a2",
"md5": "d32effa15a1adfb1c532f92ddfe85cf8",
"sha256": "20673c3431c8733d5d1615ecf79d9acf30cff75202acaf21a7d9c7f489714529"
},
"downloads": -1,
"filename": "swagger_ui_bundle-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "d32effa15a1adfb1c532f92ddfe85cf8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 2599741,
"upload_time": "2023-11-01T19:58:17",
"upload_time_iso_8601": "2023-11-01T19:58:17.397699Z",
"url": "https://files.pythonhosted.org/packages/01/e6/d8ae21087a42627c2a04a738c947825b78c26b18595704b94bd3227197a2/swagger_ui_bundle-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-11-01 19:58:17",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "spec-first",
"github_project": "swagger_ui_bundle",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "swagger-ui-bundle"
}