theneo-fastapi 0.1.0__tar.gz

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.
@@ -0,0 +1,123 @@
1
+ Metadata-Version: 2.4
2
+ Name: theneo-fastapi
3
+ Version: 0.1.0
4
+ Summary: FastAPI integration for Theneo API Reference
5
+ Author-email: Theneo <hello@theneo.io>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/Theneo-Inc/theneo-reference-api
8
+ Project-URL: Repository, https://github.com/Theneo-Inc/theneo-reference-api
9
+ Classifier: Development Status :: 4 - Beta
10
+ Classifier: Framework :: FastAPI
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Topic :: Software Development :: Documentation
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Requires-Python: >=3.8
23
+ Description-Content-Type: text/markdown
24
+ Requires-Dist: fastapi>=0.100.0
25
+
26
+ # theneo-fastapi
27
+
28
+ FastAPI integration for the **Theneo API Reference** viewer.
29
+
30
+ Serves a self-contained HTML page + bundled JS/CSS that renders your OpenAPI spec with the Theneo UI.
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ pip install theneo-fastapi
36
+ ```
37
+
38
+ **In this monorepo** (development):
39
+
40
+ ```bash
41
+ # From the repo root — build the JS bundle first
42
+ yarn install
43
+ yarn build
44
+
45
+ # Copy built assets into the Python package
46
+ bash integrations/python/fastapi/build.sh
47
+
48
+ # Install the Python package in editable mode
49
+ pip install -e integrations/python/fastapi
50
+ ```
51
+
52
+ See the [root README](../../../README.md) and [FastAPI example](../../../examples/fastapi-example/README.md).
53
+
54
+ ## Usage
55
+
56
+ ### Quick — `get_theneo_html`
57
+
58
+ Return the HTML page yourself in any route:
59
+
60
+ ```python
61
+ from fastapi import FastAPI
62
+ from fastapi.responses import HTMLResponse
63
+ from starlette.staticfiles import StaticFiles
64
+ from theneo_fastapi import get_theneo_html
65
+
66
+ app = FastAPI()
67
+
68
+ @app.get("/docs", response_class=HTMLResponse, include_in_schema=False)
69
+ async def docs():
70
+ return get_theneo_html(openapi_url="/openapi.json", title="My API")
71
+
72
+ # Mount the bundled JS/CSS assets
73
+ import theneo_fastapi, pathlib
74
+ assets_dir = pathlib.Path(theneo_fastapi.__file__).parent / "assets"
75
+ app.mount("/theneo-assets", StaticFiles(directory=str(assets_dir)), name="theneo-assets")
76
+ ```
77
+
78
+ ### Router factory — `create_theneo_router`
79
+
80
+ Creates a router + static mount in one call:
81
+
82
+ ```python
83
+ from fastapi import FastAPI
84
+ from theneo_fastapi import create_theneo_router
85
+
86
+ app = FastAPI(docs_url=None, redoc_url=None)
87
+
88
+ router, static = create_theneo_router(openapi_url="/openapi.json", title="My API")
89
+ app.include_router(router)
90
+ app.mount("/theneo-assets", static, name="theneo-assets")
91
+ ```
92
+
93
+ Visit `http://localhost:8000/docs`.
94
+
95
+ ## `get_theneo_html(**kwargs)`
96
+
97
+ Returns a complete HTML string.
98
+
99
+ | Parameter | Type | Default | Description |
100
+ |-----------|------|---------|-------------|
101
+ | `openapi_url` | `str \| None` | `None` | URL the client fetches for the OpenAPI document. |
102
+ | `title` | `str` | `"API Reference"` | `<title>` and header text. |
103
+ | `spec` | `dict \| None` | `None` | Inline OpenAPI object. If `openapi_url` is also set, the URL wins. |
104
+ | `assets_base` | `str` | `"/theneo-assets"` | URL prefix for `theneo.umd.js` and `style.css`. |
105
+
106
+ ## `create_theneo_router(**kwargs)`
107
+
108
+ Returns `(APIRouter, StaticFiles)`.
109
+
110
+ Same parameters as `get_theneo_html` plus:
111
+
112
+ | Parameter | Type | Default | Description |
113
+ |-----------|------|---------|-------------|
114
+ | `assets_path` | `str` | `"/theneo-assets"` | Mount path for assets (must match `assets_base`). |
115
+
116
+ ## Assets
117
+
118
+ The bundled `theneo.umd.js` and `style.css` live in `theneo_fastapi/assets/`. They are copied from `@theneo/vanilla/dist` by `build.sh` (see installation above).
119
+
120
+ ## Requirements
121
+
122
+ - Python >= 3.8
123
+ - FastAPI >= 0.100.0
@@ -0,0 +1,98 @@
1
+ # theneo-fastapi
2
+
3
+ FastAPI integration for the **Theneo API Reference** viewer.
4
+
5
+ Serves a self-contained HTML page + bundled JS/CSS that renders your OpenAPI spec with the Theneo UI.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install theneo-fastapi
11
+ ```
12
+
13
+ **In this monorepo** (development):
14
+
15
+ ```bash
16
+ # From the repo root — build the JS bundle first
17
+ yarn install
18
+ yarn build
19
+
20
+ # Copy built assets into the Python package
21
+ bash integrations/python/fastapi/build.sh
22
+
23
+ # Install the Python package in editable mode
24
+ pip install -e integrations/python/fastapi
25
+ ```
26
+
27
+ See the [root README](../../../README.md) and [FastAPI example](../../../examples/fastapi-example/README.md).
28
+
29
+ ## Usage
30
+
31
+ ### Quick — `get_theneo_html`
32
+
33
+ Return the HTML page yourself in any route:
34
+
35
+ ```python
36
+ from fastapi import FastAPI
37
+ from fastapi.responses import HTMLResponse
38
+ from starlette.staticfiles import StaticFiles
39
+ from theneo_fastapi import get_theneo_html
40
+
41
+ app = FastAPI()
42
+
43
+ @app.get("/docs", response_class=HTMLResponse, include_in_schema=False)
44
+ async def docs():
45
+ return get_theneo_html(openapi_url="/openapi.json", title="My API")
46
+
47
+ # Mount the bundled JS/CSS assets
48
+ import theneo_fastapi, pathlib
49
+ assets_dir = pathlib.Path(theneo_fastapi.__file__).parent / "assets"
50
+ app.mount("/theneo-assets", StaticFiles(directory=str(assets_dir)), name="theneo-assets")
51
+ ```
52
+
53
+ ### Router factory — `create_theneo_router`
54
+
55
+ Creates a router + static mount in one call:
56
+
57
+ ```python
58
+ from fastapi import FastAPI
59
+ from theneo_fastapi import create_theneo_router
60
+
61
+ app = FastAPI(docs_url=None, redoc_url=None)
62
+
63
+ router, static = create_theneo_router(openapi_url="/openapi.json", title="My API")
64
+ app.include_router(router)
65
+ app.mount("/theneo-assets", static, name="theneo-assets")
66
+ ```
67
+
68
+ Visit `http://localhost:8000/docs`.
69
+
70
+ ## `get_theneo_html(**kwargs)`
71
+
72
+ Returns a complete HTML string.
73
+
74
+ | Parameter | Type | Default | Description |
75
+ |-----------|------|---------|-------------|
76
+ | `openapi_url` | `str \| None` | `None` | URL the client fetches for the OpenAPI document. |
77
+ | `title` | `str` | `"API Reference"` | `<title>` and header text. |
78
+ | `spec` | `dict \| None` | `None` | Inline OpenAPI object. If `openapi_url` is also set, the URL wins. |
79
+ | `assets_base` | `str` | `"/theneo-assets"` | URL prefix for `theneo.umd.js` and `style.css`. |
80
+
81
+ ## `create_theneo_router(**kwargs)`
82
+
83
+ Returns `(APIRouter, StaticFiles)`.
84
+
85
+ Same parameters as `get_theneo_html` plus:
86
+
87
+ | Parameter | Type | Default | Description |
88
+ |-----------|------|---------|-------------|
89
+ | `assets_path` | `str` | `"/theneo-assets"` | Mount path for assets (must match `assets_base`). |
90
+
91
+ ## Assets
92
+
93
+ The bundled `theneo.umd.js` and `style.css` live in `theneo_fastapi/assets/`. They are copied from `@theneo/vanilla/dist` by `build.sh` (see installation above).
94
+
95
+ ## Requirements
96
+
97
+ - Python >= 3.8
98
+ - FastAPI >= 0.100.0
@@ -0,0 +1,38 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "theneo-fastapi"
7
+ version = "0.1.0"
8
+ description = "FastAPI integration for Theneo API Reference"
9
+ readme = "README.md"
10
+ license = { text = "MIT" }
11
+ requires-python = ">=3.8"
12
+ authors = [{ name = "Theneo", email = "hello@theneo.io" }]
13
+ dependencies = ["fastapi>=0.100.0"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Framework :: FastAPI",
17
+ "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: MIT License",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Software Development :: Documentation",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/Theneo-Inc/theneo-reference-api"
32
+ Repository = "https://github.com/Theneo-Inc/theneo-reference-api"
33
+
34
+ [tool.setuptools.packages.find]
35
+ include = ["theneo_fastapi*"]
36
+
37
+ [tool.setuptools.package-data]
38
+ theneo_fastapi = ["assets/*"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ from theneo_fastapi.html import get_theneo_html
2
+ from theneo_fastapi.routes import create_theneo_router
3
+
4
+ __all__ = ["get_theneo_html", "create_theneo_router"]
@@ -0,0 +1 @@
1
+ .theneo-vanilla-root{font-family:system-ui,-apple-system,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;line-height:1.5;color:#1a1a1a;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}