fastapi-voyager 0.11.8__tar.gz → 0.11.10__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.
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/PKG-INFO +37 -12
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/README.md +36 -11
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/server.py +4 -28
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/type_helper.py +7 -10
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/version.py +1 -1
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/demo.py +6 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/programatic.py +1 -1
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/.github/workflows/publish.yml +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/.gitignore +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/.python-version +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/LICENSE +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/pyproject.toml +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/release.md +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/__init__.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/cli.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/filter.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/module.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/render.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/type.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/voyager.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/component/render-graph.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/component/schema-code-display.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/component/schema-field-filter.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/graph-ui.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/index.html +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/quasar.min.css +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/quasar.min.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/vue-main.js +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/__init__.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/demo_anno.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/service/__init__.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/service/schema.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_analysis.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_filter.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_generic.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_import.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_module.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/tests/test_type_helper.py +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/uv.lock +0 -0
- {fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/voyager.jpg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-voyager
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.10
|
|
4
4
|
Summary: Visualize FastAPI application's routing tree and dependencies
|
|
5
5
|
Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
|
|
6
6
|
Project-URL: Source, https://github.com/allmonday/fastapi-voyager
|
|
@@ -34,14 +34,7 @@ Description-Content-Type: text/markdown
|
|
|
34
34
|
|
|
35
35
|
> This repo is still in early stage, it supports pydantic v2 only
|
|
36
36
|
|
|
37
|
-
FastAPI
|
|
38
|
-
|
|
39
|
-
- design your API
|
|
40
|
-
- inspect your API
|
|
41
|
-
- refactor your API
|
|
42
|
-
|
|
43
|
-
interactively !!
|
|
44
|
-
|
|
37
|
+
Visualize your FastAPI endpoints, and explore them interactively.
|
|
45
38
|
|
|
46
39
|
[visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
|
|
47
40
|
|
|
@@ -59,6 +52,9 @@ uv add fastapi-voyager
|
|
|
59
52
|
voyager -m path.to.your.app.module --server
|
|
60
53
|
```
|
|
61
54
|
|
|
55
|
+
> *sub_app* is not supported yet.
|
|
56
|
+
|
|
57
|
+
|
|
62
58
|
## Mount into project
|
|
63
59
|
|
|
64
60
|
```python
|
|
@@ -177,6 +173,7 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
177
173
|
- [ ] add route/tag list
|
|
178
174
|
- [ ] type alias should not be kept as node instead of compiling to original type
|
|
179
175
|
- [ ] how to correctly handle the generic type ?
|
|
176
|
+
- [ ] support Google analysis config
|
|
180
177
|
|
|
181
178
|
### in analysis
|
|
182
179
|
- [ ] click field to highlight links
|
|
@@ -278,6 +275,10 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
278
275
|
- [x] fix swagger link
|
|
279
276
|
- 0.11.8
|
|
280
277
|
- [x] fix swagger link in another way
|
|
278
|
+
- 0.11.9
|
|
279
|
+
- [x] replace issubclass with safe_issubclass to prevent exception.
|
|
280
|
+
- 0.11.10
|
|
281
|
+
- [x] fix bug during updating forward refs
|
|
281
282
|
|
|
282
283
|
#### 0.12
|
|
283
284
|
- [ ] add tests
|
|
@@ -289,12 +290,13 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
289
290
|
- [ ] config release pipeline
|
|
290
291
|
|
|
291
292
|
|
|
292
|
-
##
|
|
293
|
+
## About pydantic-resolve
|
|
293
294
|
|
|
294
|
-
|
|
295
|
+
pydantic-resolve's `@ensure_subset` decorator helps safely pick fields from the 'source class' while indicating the reference from the current class to the base class.
|
|
295
296
|
|
|
296
|
-
pydantic-resolve
|
|
297
|
+
pydantic-resolve is a lightweight tool designed to build complex, nested data in a simple, declarative way. In version 2, it will introduce an important feature: ER model definition, and fastapi-voyager will support and visualize these diagrams.
|
|
297
298
|
|
|
299
|
+
Developers can use fastapi-voyager without needing to know about pydantic-resolve.
|
|
298
300
|
|
|
299
301
|
|
|
300
302
|
## Credits
|
|
@@ -309,3 +311,26 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
|
|
|
309
311
|
- [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
|
|
310
312
|
- Quasar
|
|
311
313
|
|
|
314
|
+
|
|
315
|
+
## How to develop & contribute?
|
|
316
|
+
|
|
317
|
+
fork, clone.
|
|
318
|
+
|
|
319
|
+
install uv.
|
|
320
|
+
|
|
321
|
+
```shell
|
|
322
|
+
uv venv
|
|
323
|
+
source .venv/bin/activate
|
|
324
|
+
uv pip install ".[dev]"
|
|
325
|
+
uvicorn tests.programatic:app --reload
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
open `localhost:8000/voyager`
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
frontend: `src/web/vue-main.js`
|
|
332
|
+
backend: `voyager.py`, `render.py`, `server.py`
|
|
333
|
+
|
|
334
|
+
## Branch and Release flow
|
|
335
|
+
|
|
336
|
+
TODO
|
|
@@ -5,14 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
> This repo is still in early stage, it supports pydantic v2 only
|
|
7
7
|
|
|
8
|
-
FastAPI
|
|
9
|
-
|
|
10
|
-
- design your API
|
|
11
|
-
- inspect your API
|
|
12
|
-
- refactor your API
|
|
13
|
-
|
|
14
|
-
interactively !!
|
|
15
|
-
|
|
8
|
+
Visualize your FastAPI endpoints, and explore them interactively.
|
|
16
9
|
|
|
17
10
|
[visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
|
|
18
11
|
|
|
@@ -30,6 +23,9 @@ uv add fastapi-voyager
|
|
|
30
23
|
voyager -m path.to.your.app.module --server
|
|
31
24
|
```
|
|
32
25
|
|
|
26
|
+
> *sub_app* is not supported yet.
|
|
27
|
+
|
|
28
|
+
|
|
33
29
|
## Mount into project
|
|
34
30
|
|
|
35
31
|
```python
|
|
@@ -148,6 +144,7 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
148
144
|
- [ ] add route/tag list
|
|
149
145
|
- [ ] type alias should not be kept as node instead of compiling to original type
|
|
150
146
|
- [ ] how to correctly handle the generic type ?
|
|
147
|
+
- [ ] support Google analysis config
|
|
151
148
|
|
|
152
149
|
### in analysis
|
|
153
150
|
- [ ] click field to highlight links
|
|
@@ -249,6 +246,10 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
249
246
|
- [x] fix swagger link
|
|
250
247
|
- 0.11.8
|
|
251
248
|
- [x] fix swagger link in another way
|
|
249
|
+
- 0.11.9
|
|
250
|
+
- [x] replace issubclass with safe_issubclass to prevent exception.
|
|
251
|
+
- 0.11.10
|
|
252
|
+
- [x] fix bug during updating forward refs
|
|
252
253
|
|
|
253
254
|
#### 0.12
|
|
254
255
|
- [ ] add tests
|
|
@@ -260,12 +261,13 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
|
|
|
260
261
|
- [ ] config release pipeline
|
|
261
262
|
|
|
262
263
|
|
|
263
|
-
##
|
|
264
|
+
## About pydantic-resolve
|
|
264
265
|
|
|
265
|
-
|
|
266
|
+
pydantic-resolve's `@ensure_subset` decorator helps safely pick fields from the 'source class' while indicating the reference from the current class to the base class.
|
|
266
267
|
|
|
267
|
-
pydantic-resolve
|
|
268
|
+
pydantic-resolve is a lightweight tool designed to build complex, nested data in a simple, declarative way. In version 2, it will introduce an important feature: ER model definition, and fastapi-voyager will support and visualize these diagrams.
|
|
268
269
|
|
|
270
|
+
Developers can use fastapi-voyager without needing to know about pydantic-resolve.
|
|
269
271
|
|
|
270
272
|
|
|
271
273
|
## Credits
|
|
@@ -280,3 +282,26 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
|
|
|
280
282
|
- [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
|
|
281
283
|
- Quasar
|
|
282
284
|
|
|
285
|
+
|
|
286
|
+
## How to develop & contribute?
|
|
287
|
+
|
|
288
|
+
fork, clone.
|
|
289
|
+
|
|
290
|
+
install uv.
|
|
291
|
+
|
|
292
|
+
```shell
|
|
293
|
+
uv venv
|
|
294
|
+
source .venv/bin/activate
|
|
295
|
+
uv pip install ".[dev]"
|
|
296
|
+
uvicorn tests.programatic:app --reload
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
open `localhost:8000/voyager`
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
frontend: `src/web/vue-main.js`
|
|
303
|
+
backend: `voyager.py`, `render.py`, `server.py`
|
|
304
|
+
|
|
305
|
+
## Branch and Release flow
|
|
306
|
+
|
|
307
|
+
TODO
|
|
@@ -38,18 +38,15 @@ class Payload(BaseModel):
|
|
|
38
38
|
show_module: bool = True
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
def
|
|
41
|
+
def create_voyager(
|
|
42
42
|
target_app: FastAPI,
|
|
43
43
|
module_color: dict[str, str] | None = None,
|
|
44
|
-
|
|
44
|
+
gzip_minimum_size: int | None = 500,
|
|
45
45
|
module_prefix: Optional[str] = None,
|
|
46
|
+
swagger_url: Optional[str] = None,
|
|
46
47
|
online_repo_url: Optional[str] = None,
|
|
47
48
|
initial_page_policy: INITIAL_PAGE_POLICY = 'first',
|
|
48
|
-
):
|
|
49
|
-
"""
|
|
50
|
-
module_color: dict mapping module name to color string, e.g. {'models': 'lightblue'}
|
|
51
|
-
module_prefix: prefix string to define schemas show in brief mode
|
|
52
|
-
"""
|
|
49
|
+
) -> FastAPI:
|
|
53
50
|
router = APIRouter(tags=['fastapi-voyager'])
|
|
54
51
|
|
|
55
52
|
@router.get("/dot", response_model=OptionParam)
|
|
@@ -207,27 +204,6 @@ def create_route(
|
|
|
207
204
|
content={"error": f"Internal error: {str(e)}"}
|
|
208
205
|
)
|
|
209
206
|
|
|
210
|
-
return router
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
def create_voyager(
|
|
214
|
-
target_app: FastAPI,
|
|
215
|
-
module_color: dict[str, str] | None = None,
|
|
216
|
-
gzip_minimum_size: int | None = 500,
|
|
217
|
-
module_prefix: Optional[str] = None,
|
|
218
|
-
swagger_url: Optional[str] = None,
|
|
219
|
-
online_repo_url: Optional[str] = None,
|
|
220
|
-
initial_page_policy: INITIAL_PAGE_POLICY = 'first',
|
|
221
|
-
) -> FastAPI:
|
|
222
|
-
router = create_route(
|
|
223
|
-
target_app,
|
|
224
|
-
module_color=module_color,
|
|
225
|
-
module_prefix=module_prefix,
|
|
226
|
-
swagger_url=swagger_url,
|
|
227
|
-
online_repo_url=online_repo_url,
|
|
228
|
-
initial_page_policy=initial_page_policy,
|
|
229
|
-
)
|
|
230
|
-
|
|
231
207
|
app = FastAPI(title="fastapi-voyager demo server")
|
|
232
208
|
if gzip_minimum_size is not None and gzip_minimum_size >= 0:
|
|
233
209
|
app.add_middleware(GZipMiddleware, minimum_size=gzip_minimum_size)
|
|
@@ -232,27 +232,24 @@ def safe_issubclass(kls, classinfo):
|
|
|
232
232
|
try:
|
|
233
233
|
return issubclass(kls, classinfo)
|
|
234
234
|
except TypeError:
|
|
235
|
-
|
|
235
|
+
# may raise error for corner case such as ForwardRef
|
|
236
|
+
print(str(kls), 'is not a target class')
|
|
236
237
|
return False
|
|
237
238
|
|
|
238
239
|
|
|
239
240
|
def update_forward_refs(kls):
|
|
240
241
|
# TODO: refactor
|
|
241
|
-
def update_pydantic_forward_refs(
|
|
242
|
+
def update_pydantic_forward_refs(pydantic_kls: Type[BaseModel]):
|
|
242
243
|
"""
|
|
243
244
|
recursively update refs.
|
|
244
245
|
"""
|
|
245
246
|
|
|
246
|
-
|
|
247
|
-
setattr(
|
|
247
|
+
pydantic_kls.model_rebuild()
|
|
248
|
+
setattr(pydantic_kls, const.PYDANTIC_FORWARD_REF_UPDATED, True)
|
|
248
249
|
|
|
249
|
-
values =
|
|
250
|
+
values = pydantic_kls.model_fields.values()
|
|
250
251
|
for field in values:
|
|
251
252
|
update_forward_refs(field.annotation)
|
|
252
|
-
|
|
253
|
-
if safe_issubclass(kls, BaseModel):
|
|
254
|
-
kls.model_rebuild()
|
|
255
|
-
setattr(kls, const.PYDANTIC_FORWARD_REF_UPDATED, True)
|
|
256
253
|
|
|
257
254
|
for shelled_type in get_core_types(kls):
|
|
258
255
|
if getattr(shelled_type, const.PYDANTIC_FORWARD_REF_UPDATED, False):
|
|
@@ -283,7 +280,7 @@ def is_generic_container(cls):
|
|
|
283
280
|
|
|
284
281
|
def is_non_pydantic_type(tp):
|
|
285
282
|
for schema in get_core_types(tp):
|
|
286
|
-
if schema and
|
|
283
|
+
if schema and safe_issubclass(schema, BaseModel):
|
|
287
284
|
return False
|
|
288
285
|
return True
|
|
289
286
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.11.
|
|
2
|
+
__version__ = "0.11.10"
|
|
@@ -4,6 +4,7 @@ from typing import Optional, Generic, TypeVar
|
|
|
4
4
|
from pydantic_resolve import ensure_subset, Resolver
|
|
5
5
|
from tests.service.schema import Story, Task, A
|
|
6
6
|
import tests.service.schema as serv
|
|
7
|
+
from dataclasses import dataclass
|
|
7
8
|
|
|
8
9
|
app = FastAPI(title="Demo API", description="A demo FastAPI application for router visualization")
|
|
9
10
|
|
|
@@ -15,6 +16,11 @@ class PageMember(serv.Member):
|
|
|
15
16
|
fullname: str = ''
|
|
16
17
|
def post_fullname(self):
|
|
17
18
|
return self.first_name + ' ' + self.last_name
|
|
19
|
+
sh: 'Something' # forward reference
|
|
20
|
+
|
|
21
|
+
@dataclass
|
|
22
|
+
class Something:
|
|
23
|
+
id: int
|
|
18
24
|
|
|
19
25
|
class TaskA(Task):
|
|
20
26
|
task_type: str = 'A'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/component/render-graph.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/apple-touch-icon.png
RENAMED
|
File without changes
|
{fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/favicon-16x16.png
RENAMED
|
File without changes
|
{fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/favicon-32x32.png
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_voyager-0.11.8 → fastapi_voyager-0.11.10}/src/fastapi_voyager/web/icon/site.webmanifest
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|