rapidoc 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rapidoc/__init__.py +41 -0
- rapidoc/assets/integration.json +43 -0
- rapidoc/assets/rapidoc-min.js +700 -0
- rapidoc/assets/rapidoc-min.js.LICENSE.txt +381 -0
- rapidoc/contract.py +229 -0
- rapidoc/fastapi.py +9 -0
- rapidoc/starlette.py +141 -0
- rapidoc-0.1.0.dist-info/METADATA +82 -0
- rapidoc-0.1.0.dist-info/RECORD +11 -0
- rapidoc-0.1.0.dist-info/WHEEL +4 -0
- rapidoc-0.1.0.dist-info/licenses/LICENSE.txt +22 -0
rapidoc/__init__.py
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"""RapiDoc for Python web frameworks.
|
|
2
|
+
|
|
3
|
+
from fastapi import FastAPI
|
|
4
|
+
from rapidoc.fastapi import setup_rapidoc
|
|
5
|
+
|
|
6
|
+
app = FastAPI(docs_url=None, redoc_url=None)
|
|
7
|
+
setup_rapidoc(app) # the reference at /docs, reading the app's /openapi.json
|
|
8
|
+
|
|
9
|
+
``rapidoc.contract`` is the RapiDoc integration contract in Python (a port of ``@rapidoc/embed``): the page,
|
|
10
|
+
the routes and the attributes. A framework module (``rapidoc.fastapi``, ``rapidoc.starlette``) only maps
|
|
11
|
+
them to that framework's routes. This module imports no framework.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
import json
|
|
17
|
+
from pathlib import Path
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from . import contract
|
|
21
|
+
|
|
22
|
+
__all__ = ["rapidoc_version", "rapidoc_manifest", "contract", "ASSETS"]
|
|
23
|
+
|
|
24
|
+
#: One rapidoc release: the bundle, its license file and integration.json
|
|
25
|
+
ASSETS = Path(__file__).parent / "assets"
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def rapidoc_manifest() -> dict[str, Any]:
|
|
29
|
+
"""``integration.json`` of the rapidoc release this package ships: version, files, SRI hashes."""
|
|
30
|
+
file = ASSETS / "integration.json"
|
|
31
|
+
if not file.exists():
|
|
32
|
+
raise RuntimeError(
|
|
33
|
+
"rapidoc: the rapidoc bundle is missing from this installation "
|
|
34
|
+
"(in a source checkout, run scripts/sync_assets.py)"
|
|
35
|
+
)
|
|
36
|
+
return json.loads(file.read_text(encoding="utf-8"))
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def rapidoc_version() -> str:
|
|
40
|
+
"""The version of rapidoc this package serves."""
|
|
41
|
+
return rapidoc_manifest()["version"]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"contract": 1,
|
|
3
|
+
"name": "rapidoc",
|
|
4
|
+
"version": "12.2.0",
|
|
5
|
+
"elements": [
|
|
6
|
+
"rapi-doc",
|
|
7
|
+
"rapi-doc-mini",
|
|
8
|
+
"oauth-receiver"
|
|
9
|
+
],
|
|
10
|
+
"cdn": "https://cdn.jsdelivr.net/npm/rapidoc@12.2.0/dist/",
|
|
11
|
+
"files": {
|
|
12
|
+
"rapidoc-min.js": {
|
|
13
|
+
"role": "script",
|
|
14
|
+
"contentType": "text/javascript; charset=utf-8",
|
|
15
|
+
"bytes": 643136,
|
|
16
|
+
"integrity": "sha384-1JA7hsG9FwOzHQnEH+aOO9WV+k74Ft3W1rjU1P7E4RtAXHaVqDP8sa49oGLhuzHD"
|
|
17
|
+
},
|
|
18
|
+
"rapidoc-min.js.LICENSE.txt": {
|
|
19
|
+
"role": "license",
|
|
20
|
+
"contentType": "text/plain; charset=utf-8",
|
|
21
|
+
"bytes": 19073,
|
|
22
|
+
"integrity": "sha384-f2/nGiQja338BGgbRRM9Qb++auJfKpfflao4DEGOVuXc+Y2ORfDs1MugRjYeLXbu"
|
|
23
|
+
},
|
|
24
|
+
"oauth-receiver.html": {
|
|
25
|
+
"role": "oauth-receiver",
|
|
26
|
+
"contentType": "text/html; charset=utf-8",
|
|
27
|
+
"bytes": 236,
|
|
28
|
+
"integrity": "sha384-rfos5ZPmmjObE/xd+YkxUxo2Pj7jgdyLD4FaC9OiacqFZIh53ENId1EYcXyOCcLW"
|
|
29
|
+
},
|
|
30
|
+
"rapidoc-flow-min.js": {
|
|
31
|
+
"role": "flow-script",
|
|
32
|
+
"contentType": "text/javascript; charset=utf-8",
|
|
33
|
+
"bytes": 213829,
|
|
34
|
+
"integrity": "sha384-asDo0SV5f87CcYYk9KjQKpLggdr8OBXYrd/8TV2MvLF/YHGYG9K/9n0OYJUSn/5P"
|
|
35
|
+
},
|
|
36
|
+
"rapidoc-flow-min.js.LICENSE.txt": {
|
|
37
|
+
"role": "flow-license",
|
|
38
|
+
"contentType": "text/plain; charset=utf-8",
|
|
39
|
+
"bytes": 8286,
|
|
40
|
+
"integrity": "sha384-oaDE7s/9ktovzg47bUf0BY+Ksq+YFB84dQKb+WJbfNfk3E7Nd/PUx2RlQZwUS25W"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|