# 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/83/d0/974234324d1e184eeab4c7c8f4015a82717b5f15e190ab66174cce7b5fe6/stopments-25.2.6.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": "25.2.6",
"project_urls": {
"Repository": "https://github.com/Bing-su/stopments"
},
"split_keywords": [
"stoplight",
" elements",
" openapi",
" swagger"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "a85090228771021b37d3e8c7ad687d939fe61dee0270ef12528f5f5def756342",
"md5": "3f9c3f3b4146e365e2650aceb16b3490",
"sha256": "197f0f5d38933ff642f0e2823d0c5f923f8be1c59e3c7b1c4051f964e6690e7f"
},
"downloads": -1,
"filename": "stopments-25.2.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3f9c3f3b4146e365e2650aceb16b3490",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 652216,
"upload_time": "2025-02-06T05:10:29",
"upload_time_iso_8601": "2025-02-06T05:10:29.816477Z",
"url": "https://files.pythonhosted.org/packages/a8/50/90228771021b37d3e8c7ad687d939fe61dee0270ef12528f5f5def756342/stopments-25.2.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "83d0974234324d1e184eeab4c7c8f4015a82717b5f15e190ab66174cce7b5fe6",
"md5": "f0350ae4b57dcbf99f50cb5f842e50ae",
"sha256": "cc214f3be86d4fd87e064af5c8e8f8d4b65ea748ff8673ed3c414a2d7e56f86f"
},
"downloads": -1,
"filename": "stopments-25.2.6.tar.gz",
"has_sig": false,
"md5_digest": "f0350ae4b57dcbf99f50cb5f842e50ae",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 651684,
"upload_time": "2025-02-06T05:10:32",
"upload_time_iso_8601": "2025-02-06T05:10:32.195556Z",
"url": "https://files.pythonhosted.org/packages/83/d0/974234324d1e184eeab4c7c8f4015a82717b5f15e190ab66174cce7b5fe6/stopments-25.2.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-06 05:10:32",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Bing-su",
"github_project": "stopments",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "stopments"
}