fastapi-voyager 0.11.7__py3-none-any.whl → 0.11.9__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.
fastapi_voyager/server.py CHANGED
@@ -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
  )
@@ -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
@@ -3,11 +3,11 @@ fastapi_voyager/cli.py,sha256=kQb4g6JEGZR99e5r8LyFFEeb_-uT-n_gp_sDoYG3R7k,11118
3
3
  fastapi_voyager/filter.py,sha256=GY2J9Vfsf_wbFwC-0t74-Lf-OlO77PnhEXD_rmgkfSw,11574
4
4
  fastapi_voyager/module.py,sha256=Z2QHNmiLk6ZAJlm2nSmO875Q33TweSg8UxZSzIpU9zY,3499
5
5
  fastapi_voyager/render.py,sha256=vdwqIync2wsP8gMPY0v_XjRhdPBtbKyRT8yTBa_Ep3Y,8744
6
- fastapi_voyager/server.py,sha256=upc38XFWr3UqAxbst-EAqf3_uaA9eS0Q_pzn3gE59jk,7143
6
+ fastapi_voyager/server.py,sha256=G48St-leUcEwshIhTYVotxuFWXDAvzjthOCK9AKh9dI,6497
7
7
  fastapi_voyager/type.py,sha256=VmcTB1G-LOT70EWCzi4LU_FUkSGWUIBJX15T_J5HnOo,1764
8
- fastapi_voyager/type_helper.py,sha256=QqP4c642vEkoWTZAtl_Vvt-kys3MkVDp4BNkLrw5mHQ,9477
9
- fastapi_voyager/version.py,sha256=FDsWNAszzeAI5uYptGQNcnHKwUJ5yQ8avSPu41kgadI,49
10
- fastapi_voyager/voyager.py,sha256=Ocj4gKK8S3QMBlJYUmqRzSEKjGLV1lBuNsljEKYLV5M,13673
8
+ fastapi_voyager/type_helper.py,sha256=uJI3UQHJ8zcJq_QBnU9FtHl8m2XKTU6ATOhj6IIP91U,9482
9
+ fastapi_voyager/version.py,sha256=Wb6eX7VamWPEx6nEYtqHwXME7cHmNHnzkrPw148hvJk,49
10
+ fastapi_voyager/voyager.py,sha256=nioo56oFDeZ8nwwPWDtaQbkpe4pVssFoBVHCWFhs0K4,13549
11
11
  fastapi_voyager/web/graph-ui.js,sha256=DTedkpZNbtufexONVkJ8mOwF_-VnvxoReYHtox6IKR4,5842
12
12
  fastapi_voyager/web/graphviz.svg.css,sha256=zDCjjpT0Idufu5YOiZI76PL70-avP3vTyzGPh9M85Do,1563
13
13
  fastapi_voyager/web/graphviz.svg.js,sha256=lvAdbjHc-lMSk4GQp-iqYA2PCFX4RKnW7dFaoe0LUHs,16005
@@ -26,8 +26,8 @@ fastapi_voyager/web/icon/favicon-16x16.png,sha256=JC07jEzfIYxBIoQn_FHXvyHuxESdhW
26
26
  fastapi_voyager/web/icon/favicon-32x32.png,sha256=C7v1h58cfWOsiLp9yOIZtlx-dLasBcq3NqpHVGRmpt4,1859
27
27
  fastapi_voyager/web/icon/favicon.ico,sha256=tZolYIXkkBcFiYl1A8ksaXN2VjGamzcSdes838dLvNc,15406
28
28
  fastapi_voyager/web/icon/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
29
- fastapi_voyager-0.11.7.dist-info/METADATA,sha256=M0F4nnUPt_wY5cot9IIf_fpFieR80iMDwN8nBmwblfk,9780
30
- fastapi_voyager-0.11.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- fastapi_voyager-0.11.7.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
- fastapi_voyager-0.11.7.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
- fastapi_voyager-0.11.7.dist-info/RECORD,,
29
+ fastapi_voyager-0.11.9.dist-info/METADATA,sha256=Lu6dgQqkJyfjVIO-NSzXKRdnq4HF30lD6_XXPqt51m8,10655
30
+ fastapi_voyager-0.11.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
+ fastapi_voyager-0.11.9.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
+ fastapi_voyager-0.11.9.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
+ fastapi_voyager-0.11.9.dist-info/RECORD,,