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:
.. code-block:: python
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:
.. code-block:: python
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:
.. 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/py-swagger-ui",
"name": "py-swagger-ui",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<4.0",
"maintainer_email": "",
"keywords": "swagger-ui",
"author": "Robbe Sneyders",
"author_email": "robbe.sneyders@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/92/94/c2484ced144c2dd48d7939b30762ff11f9b9311db0f6f877217d4163203e/py_swagger_ui-1.1.0.tar.gz",
"platform": null,
"description": "py_swagger_ui\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 py_swagger_ui package like so:\n\n.. code-block:: python\n \n from py_swagger_ui 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 py_swagger_ui 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",
"split_keywords": [
"swagger-ui"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2120040f4f715bca4f2efcbe415d65e29e661b4a18badb5ac4e0773f7500f80a",
"md5": "eb1e386c04f9aa58fb1a9fc4a76db750",
"sha256": "0e6703e8834b2d412cf48d8065dcf1f6fa865e41142dca5a51e9b2060050a3b9"
},
"downloads": -1,
"filename": "py_swagger_ui-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "eb1e386c04f9aa58fb1a9fc4a76db750",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<4.0",
"size": 7557780,
"upload_time": "2023-01-07T19:47:29",
"upload_time_iso_8601": "2023-01-07T19:47:29.462882Z",
"url": "https://files.pythonhosted.org/packages/21/20/040f4f715bca4f2efcbe415d65e29e661b4a18badb5ac4e0773f7500f80a/py_swagger_ui-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9294c2484ced144c2dd48d7939b30762ff11f9b9311db0f6f877217d4163203e",
"md5": "72e3d776432b7d87f429ae466d6878ad",
"sha256": "d2660e53f130c2093fd29eaa1ea07fcf2a832a15914abf865de493da5b97926d"
},
"downloads": -1,
"filename": "py_swagger_ui-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "72e3d776432b7d87f429ae466d6878ad",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<4.0",
"size": 7487106,
"upload_time": "2023-01-07T19:47:31",
"upload_time_iso_8601": "2023-01-07T19:47:31.751461Z",
"url": "https://files.pythonhosted.org/packages/92/94/c2484ced144c2dd48d7939b30762ff11f9b9311db0f6f877217d4163203e/py_swagger_ui-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-07 19:47:31",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "spec-first",
"github_project": "py-swagger-ui",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "py-swagger-ui"
}