fastapi-voyager 0.7.1__tar.gz → 0.7.3__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.7.1 → fastapi_voyager-0.7.3}/PKG-INFO +11 -5
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/README.md +10 -4
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/filter.py +8 -1
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/render.py +38 -28
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/version.py +1 -1
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/demo.py +6 -2
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/service/schema.py +7 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/.gitignore +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/.python-version +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/LICENSE +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/pyproject.toml +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/__init__.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/cli.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/module.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/server.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/type.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/type_helper.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/voyager.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/component/render-graph.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/component/schema-code-display.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/component/schema-field-filter.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/graph-ui.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/index.html +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/quasar.min.css +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/quasar.min.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/vue-main.js +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/__init__.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/demo_anno.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/programatic.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/service/__init__.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_analysis.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_filter.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_generic.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_import.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_module.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/tests/test_type_helper.py +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/uv.lock +0 -0
- {fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/voyager.jpg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fastapi-voyager
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.3
|
|
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
|
|
@@ -203,7 +203,13 @@ TODO: ...
|
|
|
203
203
|
|
|
204
204
|
## Changelog
|
|
205
205
|
|
|
206
|
-
- 0.7
|
|
207
|
-
-
|
|
208
|
-
-
|
|
209
|
-
-
|
|
206
|
+
- 0.7:
|
|
207
|
+
- 0.7.3
|
|
208
|
+
- fix `module_color` failure
|
|
209
|
+
- 0.7.2
|
|
210
|
+
- keep links inside filtered nodes.
|
|
211
|
+
- 0.7.1
|
|
212
|
+
- support brief mode, you can use `--module_prefix tests.service` to show links between routes and filtered schemas, to make the graph less complicated.
|
|
213
|
+
- 0.6:
|
|
214
|
+
- 0.6.2:
|
|
215
|
+
- fix generic related issue
|
|
@@ -176,7 +176,13 @@ TODO: ...
|
|
|
176
176
|
|
|
177
177
|
## Changelog
|
|
178
178
|
|
|
179
|
-
- 0.7
|
|
180
|
-
-
|
|
181
|
-
-
|
|
182
|
-
-
|
|
179
|
+
- 0.7:
|
|
180
|
+
- 0.7.3
|
|
181
|
+
- fix `module_color` failure
|
|
182
|
+
- 0.7.2
|
|
183
|
+
- keep links inside filtered nodes.
|
|
184
|
+
- 0.7.1
|
|
185
|
+
- support brief mode, you can use `--module_prefix tests.service` to show links between routes and filtered schemas, to make the graph less complicated.
|
|
186
|
+
- 0.6:
|
|
187
|
+
- 0.6.2:
|
|
188
|
+
- fix generic related issue
|
|
@@ -183,6 +183,13 @@ def filter_subgraph(
|
|
|
183
183
|
if next_node not in visited:
|
|
184
184
|
queue.append(next_node)
|
|
185
185
|
|
|
186
|
-
|
|
186
|
+
module_prefix_links = [
|
|
187
|
+
lk
|
|
188
|
+
for lk in links
|
|
189
|
+
if (lk.source_origin or "").startswith(module_prefix)
|
|
190
|
+
and (lk.target_origin or "").startswith(module_prefix)
|
|
191
|
+
]
|
|
192
|
+
|
|
193
|
+
filtered_links = tag_route_links + merged_links + module_prefix_links
|
|
187
194
|
|
|
188
195
|
return tags, routes, filtered_nodes, filtered_links
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from typing import Optional
|
|
1
2
|
from fastapi_voyager.type import SchemaNode, ModuleNode, Link, Tag, Route, FieldType, PK, ModuleRoute
|
|
2
3
|
from fastapi_voyager.module import build_module_schema_tree, build_module_route_tree
|
|
3
4
|
|
|
@@ -61,33 +62,44 @@ class Renderer:
|
|
|
61
62
|
else:
|
|
62
63
|
raise ValueError(f'Unknown link type: {link.type}')
|
|
63
64
|
|
|
64
|
-
def
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
65
|
+
def render_module_schema_wrapper(self, mods: list[ModuleNode]) -> str:
|
|
66
|
+
module_color_flag = set(self.module_color.keys())
|
|
67
|
+
print(module_color_flag)
|
|
68
|
+
|
|
69
|
+
def render_module_schema(mod: ModuleNode) -> str:
|
|
70
|
+
color: Optional[str] = None
|
|
71
|
+
|
|
72
|
+
for k in module_color_flag:
|
|
73
|
+
if mod.fullname.startswith(k):
|
|
74
|
+
module_color_flag.remove(k)
|
|
75
|
+
color = self.module_color[k]
|
|
76
|
+
break
|
|
77
|
+
|
|
78
|
+
inner_nodes = [
|
|
79
|
+
f'''
|
|
80
|
+
"{node.id}" [
|
|
81
|
+
label = {self.render_schema_label(node)}
|
|
82
|
+
shape = "plain"
|
|
83
|
+
margin="0.5,0.1"
|
|
84
|
+
];''' for node in mod.schema_nodes
|
|
85
|
+
]
|
|
86
|
+
inner_nodes_str = '\n'.join(inner_nodes)
|
|
87
|
+
child_str = '\n'.join(render_module_schema(m) for m in mod.modules)
|
|
88
|
+
return f'''
|
|
89
|
+
subgraph cluster_module_{mod.fullname.replace('.', '_')} {{
|
|
90
|
+
tooltip="{mod.fullname}"
|
|
91
|
+
color = "#666"
|
|
92
|
+
style="rounded"
|
|
93
|
+
label = " {mod.name}"
|
|
94
|
+
labeljust = "l"
|
|
95
|
+
{(f'pencolor = "{color}"' if color else 'pencolor="#ccc"')}
|
|
96
|
+
{(f'penwidth = 3' if color else 'penwidth=""')}
|
|
97
|
+
{inner_nodes_str}
|
|
98
|
+
{child_str}
|
|
99
|
+
}}'''
|
|
100
|
+
return '\n'.join(render_module_schema(m) for m in mods)
|
|
88
101
|
|
|
89
102
|
def render_module_route(self, mod: ModuleRoute) -> str:
|
|
90
|
-
color = self.module_color.get(mod.fullname)
|
|
91
103
|
# Inner route nodes, same style as flat route_str
|
|
92
104
|
inner_nodes = [
|
|
93
105
|
f'''
|
|
@@ -106,8 +118,6 @@ class Renderer:
|
|
|
106
118
|
style="rounded"
|
|
107
119
|
label = " {mod.name}"
|
|
108
120
|
labeljust = "l"
|
|
109
|
-
{(f'pencolor = "{color}"' if color else 'pencolor="#ccc"')}
|
|
110
|
-
{(f'penwidth = 3' if color else 'penwidth=""')}
|
|
111
121
|
{inner_nodes_str}
|
|
112
122
|
{child_str}
|
|
113
123
|
}}'''
|
|
@@ -126,7 +136,7 @@ class Renderer:
|
|
|
126
136
|
])
|
|
127
137
|
|
|
128
138
|
|
|
129
|
-
module_schemas_str =
|
|
139
|
+
module_schemas_str = self.render_module_schema_wrapper(module_schemas)
|
|
130
140
|
module_routes_str = '\n'.join(self.render_module_route(m) for m in module_routes)
|
|
131
141
|
link_str = '\n'.join(self.render_link(link) for link in links)
|
|
132
142
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
__all__ = ["__version__"]
|
|
2
|
-
__version__ = "0.7.
|
|
2
|
+
__version__ = "0.7.3"
|
|
@@ -2,7 +2,7 @@ from pydantic import BaseModel, Field
|
|
|
2
2
|
from fastapi import FastAPI
|
|
3
3
|
from typing import Optional, Generic, TypeVar
|
|
4
4
|
from pydantic_resolve import ensure_subset, Resolver
|
|
5
|
-
from tests.service.schema import Story, Task
|
|
5
|
+
from tests.service.schema import Story, Task, A
|
|
6
6
|
import tests.service.schema as serv
|
|
7
7
|
|
|
8
8
|
app = FastAPI(title="Demo API", description="A demo FastAPI application for router visualization")
|
|
@@ -73,4 +73,8 @@ type DataModelPageStory = DataModel[PageStory]
|
|
|
73
73
|
|
|
74
74
|
@app.get("/page_test_1/", tags=['for-page'], response_model=DataModelPageStory)
|
|
75
75
|
def get_page_test_1():
|
|
76
|
-
return {} # no implementation
|
|
76
|
+
return {} # no implementation
|
|
77
|
+
|
|
78
|
+
@app.get("/page_test_2/", tags=['for-page'], response_model=A)
|
|
79
|
+
def get_page_test_2():
|
|
80
|
+
return {}
|
|
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.7.1 → fastapi_voyager-0.7.3}/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.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/apple-touch-icon.png
RENAMED
|
File without changes
|
{fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/favicon-16x16.png
RENAMED
|
File without changes
|
{fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/src/fastapi_voyager/web/icon/favicon-32x32.png
RENAMED
|
File without changes
|
|
File without changes
|
{fastapi_voyager-0.7.1 → fastapi_voyager-0.7.3}/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
|