# Stopments
Stoplight elements static files
Refered from FastAPI's #5168 PR
It includes the following files:
- `styles.min.css`
- `web-components.min.js`
- `favicon.ico`
The static files were collected on the same date as this package version.
## Installation
```bash
pip install stopments
```
## Usage
```python
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from stopments import get_stoplight_elements_html
app = FastAPI(docs_url=None, redoc_url=None)
@app.get("/docs/", include_in_schema=False)
async def docs():
html = get_stoplight_elements_html(
openapi_url=app.openapi_url or "/openapi.json",
title="API Documentation",
)
return HTMLResponse(content=html)
```
or you can use embedded static files
```python
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
from fastapi.staticfiles import StaticFiles
from stopments import get_stoplight_elements_html
app = FastAPI(docs_url=None, redoc_url=None)
app.mount("/static", StaticFiles(packages=[("stopments", "static")]))
@app.get("/docs/", include_in_schema=False)
async def docs():
html = get_stoplight_elements_html(
openapi_url=app.openapi_url or "/openapi.json",
title="API Documentation",
stoplight_elements_css_url="/static/styles.min.css",
stoplight_elements_js_url="/static/web-components.min.js",
stoplight_elements_favicon_url="/static/favicon.ico",
)
return HTMLResponse(content=html)
```
## References
- [FastAPI PR #5168](https://github.com/fastapi/fastapi/pull/5168)
- [Stoplight Elements Docs - Usage with HTML](https://docs.stoplight.io/docs/elements/a71d7fcfefcd6-elements-in-html)
Raw data
{
"_id": null,
"home_page": null,
"name": "stopments",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "stoplight, elements, openapi, swagger",
"author": null,
"author_email": "Dowon <ks2515@naver.com>",
"download_url": "https://files.pythonhosted.org/packages/74/cf/1965cfd3125409043fd4b503274895ee626aa8894e36d5a38d680b7eec6b/stopments-24.11.9.tar.gz",
"platform": null,
"description": "# Stopments\n\nStoplight elements static files\n\nRefered from FastAPI's #5168 PR\n\nIt includes the following files:\n\n- `styles.min.css`\n- `web-components.min.js`\n- `favicon.ico`\n\nThe static files were collected on the same date as this package version.\n\n## Installation\n\n```bash\npip install stopments\n```\n\n## Usage\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi.responses import HTMLResponse\nfrom fastapi.staticfiles import StaticFiles\n\nfrom stopments import get_stoplight_elements_html\n\napp = FastAPI(docs_url=None, redoc_url=None)\n\n@app.get(\"/docs/\", include_in_schema=False)\nasync def docs():\n html = get_stoplight_elements_html(\n openapi_url=app.openapi_url or \"/openapi.json\",\n title=\"API Documentation\",\n )\n return HTMLResponse(content=html)\n```\n\nor you can use embedded static files\n\n```python\nfrom fastapi import FastAPI\nfrom fastapi.responses import HTMLResponse\nfrom fastapi.staticfiles import StaticFiles\n\nfrom stopments import get_stoplight_elements_html\n\napp = FastAPI(docs_url=None, redoc_url=None)\napp.mount(\"/static\", StaticFiles(packages=[(\"stopments\", \"static\")]))\n\n@app.get(\"/docs/\", include_in_schema=False)\nasync def docs():\n html = get_stoplight_elements_html(\n openapi_url=app.openapi_url or \"/openapi.json\",\n title=\"API Documentation\",\n stoplight_elements_css_url=\"/static/styles.min.css\",\n stoplight_elements_js_url=\"/static/web-components.min.js\",\n stoplight_elements_favicon_url=\"/static/favicon.ico\",\n )\n return HTMLResponse(content=html)\n```\n\n## References\n\n- [FastAPI PR #5168](https://github.com/fastapi/fastapi/pull/5168)\n- [Stoplight Elements Docs - Usage with HTML](https://docs.stoplight.io/docs/elements/a71d7fcfefcd6-elements-in-html)\n",
"bugtrack_url": null,
"license": "BSD-2-Clause",
"summary": "Stoplight elements html",
"version": "24.11.9",
"project_urls": {
"Repository": "https://github.com/Bing-su/stopments"
},
"split_keywords": [
"stoplight",
" elements",
" openapi",
" swagger"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0b7fc69fe8933f62d1374ab63582bcdf99e06357e56e7a7e9ce99cf8d84eafdc",
"md5": "7000327f3f7c2d6b8f13f04edd6c15c1",
"sha256": "3f832fbbf886fddd64ebb648bb7258a5ed8fcd9e0190f292e49b350243c9375f"
},
"downloads": -1,
"filename": "stopments-24.11.9-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7000327f3f7c2d6b8f13f04edd6c15c1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 634947,
"upload_time": "2024-11-09T09:18:12",
"upload_time_iso_8601": "2024-11-09T09:18:12.666299Z",
"url": "https://files.pythonhosted.org/packages/0b/7f/c69fe8933f62d1374ab63582bcdf99e06357e56e7a7e9ce99cf8d84eafdc/stopments-24.11.9-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "74cf1965cfd3125409043fd4b503274895ee626aa8894e36d5a38d680b7eec6b",
"md5": "1c3a87121c19f46d55034b0527a52615",
"sha256": "099573242b983f0e8f1c5983570db3dc56171924f74b2f5d9a5c510a5d1fdbc3"
},
"downloads": -1,
"filename": "stopments-24.11.9.tar.gz",
"has_sig": false,
"md5_digest": "1c3a87121c19f46d55034b0527a52615",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 634681,
"upload_time": "2024-11-09T09:18:14",
"upload_time_iso_8601": "2024-11-09T09:18:14.272057Z",
"url": "https://files.pythonhosted.org/packages/74/cf/1965cfd3125409043fd4b503274895ee626aa8894e36d5a38d680b7eec6b/stopments-24.11.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-09 09:18:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Bing-su",
"github_project": "stopments",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "stopments"
}