fastapi-voyager 0.11.7__tar.gz → 0.11.9__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.
Files changed (50) hide show
  1. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/PKG-INFO +37 -12
  2. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/README.md +36 -11
  3. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/server.py +4 -28
  4. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/type_helper.py +1 -1
  5. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/version.py +1 -1
  6. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/voyager.py +1 -3
  7. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/demo.py +5 -1
  8. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/programatic.py +1 -1
  9. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/.github/workflows/publish.yml +0 -0
  10. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/.gitignore +0 -0
  11. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/.python-version +0 -0
  12. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/LICENSE +0 -0
  13. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/pyproject.toml +0 -0
  14. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/release.md +0 -0
  15. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/__init__.py +0 -0
  16. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/cli.py +0 -0
  17. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/filter.py +0 -0
  18. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/module.py +0 -0
  19. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/render.py +0 -0
  20. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/type.py +0 -0
  21. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/component/render-graph.js +0 -0
  22. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
  23. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/component/schema-code-display.js +0 -0
  24. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/component/schema-field-filter.js +0 -0
  25. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/graph-ui.js +0 -0
  26. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
  27. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
  28. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
  29. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
  30. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
  31. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
  32. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
  33. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
  34. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
  35. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/index.html +0 -0
  36. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/quasar.min.css +0 -0
  37. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/quasar.min.js +0 -0
  38. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/src/fastapi_voyager/web/vue-main.js +0 -0
  39. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/__init__.py +0 -0
  40. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/demo_anno.py +0 -0
  41. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/service/__init__.py +0 -0
  42. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/service/schema.py +0 -0
  43. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_analysis.py +0 -0
  44. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_filter.py +0 -0
  45. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_generic.py +0 -0
  46. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_import.py +0 -0
  47. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_module.py +0 -0
  48. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/tests/test_type_helper.py +0 -0
  49. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/uv.lock +0 -0
  50. {fastapi_voyager-0.11.7 → fastapi_voyager-0.11.9}/voyager.jpg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.11.7
3
+ Version: 0.11.9
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 can help you:
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
@@ -276,6 +273,10 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
276
273
  - [x] optimize loading static resource
277
274
  - 0.11.7
278
275
  - [x] fix swagger link
276
+ - 0.11.8
277
+ - [x] fix swagger link in another way
278
+ - 0.11.9
279
+ - [x] replace issubclass with safe_issubclass to prevent exception.
279
280
 
280
281
  #### 0.12
281
282
  - [ ] add tests
@@ -287,12 +288,13 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
287
288
  - [ ] config release pipeline
288
289
 
289
290
 
290
- ## Using with pydantic-resolve
291
+ ## About pydantic-resolve
291
292
 
292
- WIP: ...
293
+ 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.
293
294
 
294
- pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `source class` in safe.
295
+ 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.
295
296
 
297
+ Developers can use fastapi-voyager without needing to know about pydantic-resolve.
296
298
 
297
299
 
298
300
  ## Credits
@@ -307,3 +309,26 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
307
309
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
308
310
  - Quasar
309
311
 
312
+
313
+ ## How to develop & contribute?
314
+
315
+ fork, clone.
316
+
317
+ install uv.
318
+
319
+ ```shell
320
+ uv venv
321
+ source .venv/bin/activate
322
+ uv pip install ".[dev]"
323
+ uvicorn tests.programatic:app --reload
324
+ ```
325
+
326
+ open `localhost:8000/voyager`
327
+
328
+
329
+ frontend: `src/web/vue-main.js`
330
+ backend: `voyager.py`, `render.py`, `server.py`
331
+
332
+ ## Branch and Release flow
333
+
334
+ 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 can help you:
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
@@ -247,6 +244,10 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
247
244
  - [x] optimize loading static resource
248
245
  - 0.11.7
249
246
  - [x] fix swagger link
247
+ - 0.11.8
248
+ - [x] fix swagger link in another way
249
+ - 0.11.9
250
+ - [x] replace issubclass with safe_issubclass to prevent exception.
250
251
 
251
252
  #### 0.12
252
253
  - [ ] add tests
@@ -258,12 +259,13 @@ or you can open router_viz.dot with vscode extension `graphviz interactive previ
258
259
  - [ ] config release pipeline
259
260
 
260
261
 
261
- ## Using with pydantic-resolve
262
+ ## About pydantic-resolve
262
263
 
263
- WIP: ...
264
+ 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.
264
265
 
265
- pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `source class` in safe.
266
+ 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.
266
267
 
268
+ Developers can use fastapi-voyager without needing to know about pydantic-resolve.
267
269
 
268
270
 
269
271
  ## Credits
@@ -278,3 +280,26 @@ pydantic-resolve's @ensure_subset decorator is helpful to pick fields from `sour
278
280
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
279
281
  - Quasar
280
282
 
283
+
284
+ ## How to develop & contribute?
285
+
286
+ fork, clone.
287
+
288
+ install uv.
289
+
290
+ ```shell
291
+ uv venv
292
+ source .venv/bin/activate
293
+ uv pip install ".[dev]"
294
+ uvicorn tests.programatic:app --reload
295
+ ```
296
+
297
+ open `localhost:8000/voyager`
298
+
299
+
300
+ frontend: `src/web/vue-main.js`
301
+ backend: `voyager.py`, `render.py`, `server.py`
302
+
303
+ ## Branch and Release flow
304
+
305
+ TODO
@@ -38,18 +38,15 @@ class Payload(BaseModel):
38
38
  show_module: bool = True
39
39
 
40
40
 
41
- def create_route(
41
+ def create_voyager(
42
42
  target_app: FastAPI,
43
43
  module_color: dict[str, str] | None = None,
44
- swagger_url: Optional[str] = None,
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)
@@ -283,7 +283,7 @@ def is_generic_container(cls):
283
283
 
284
284
  def is_non_pydantic_type(tp):
285
285
  for schema in get_core_types(tp):
286
- if schema and issubclass(schema, BaseModel):
286
+ if schema and safe_issubclass(schema, BaseModel):
287
287
  return False
288
288
  return True
289
289
 
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.11.7"
2
+ __version__ = "0.11.9"
@@ -29,7 +29,6 @@ class Voyager:
29
29
  route_name: str | None = None,
30
30
  hide_primitive_route: bool = False,
31
31
  show_module: bool = True,
32
- route_name_fn: Callable | None = None
33
32
  ):
34
33
 
35
34
  self.routes: list[Route] = []
@@ -52,7 +51,6 @@ class Voyager:
52
51
  self.route_name = route_name
53
52
  self.hide_primitive_route = hide_primitive_route
54
53
  self.show_module = show_module
55
- self.route_name_fn = route_name_fn
56
54
 
57
55
 
58
56
  def _get_available_route(self, app: FastAPI):
@@ -126,7 +124,7 @@ class Voyager:
126
124
  id=route_id,
127
125
  name=route_name,
128
126
  module=route_module,
129
- unique_id=self.route_name_fn(route) if self.route_name_fn else route.unique_id,
127
+ unique_id=route.operation_id or route.unique_id,
130
128
  response_schema=get_type_name(route.response_model),
131
129
  is_primitive=is_primitive_response
132
130
  )
@@ -104,4 +104,8 @@ def get_page_test_3_no_response_model():
104
104
 
105
105
  @app.get("/page_test_5/", tags=['long_long_long_tag_name', 'group_b'])
106
106
  def get_page_test_3_no_response_model():
107
- return True
107
+ return True
108
+
109
+
110
+ for r in app.router.routes:
111
+ r.operation_id = r.name
@@ -5,7 +5,7 @@ app.mount(
5
5
  '/voyager',
6
6
  create_voyager(
7
7
  app,
8
- module_color={"tests.service": "red"},
8
+ module_color={"tests.service": "purple"},
9
9
  module_prefix="tests.service",
10
10
  swagger_url="/docs",
11
11
  initial_page_policy='first',