fastapi-voyager 0.12.3__py3-none-any.whl → 0.12.4__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/render.py CHANGED
@@ -93,6 +93,8 @@ class Renderer:
93
93
 
94
94
  def render_module_schema(mod: ModuleNode, inherit_color: str | None=None, show_cluster:bool=True) -> str:
95
95
  color: str | None = inherit_color
96
+ cluster_color: str | None = None
97
+
96
98
 
97
99
  # recursively vist module from short to long: 'a', 'a.b', 'a.b.c'
98
100
  # color_flag: {'a', 'a.b.c'}
@@ -103,6 +105,7 @@ class Renderer:
103
105
  if mod.fullname.startswith(k):
104
106
  module_color_flag.remove(k)
105
107
  color = self.module_color[k]
108
+ cluster_color = color if color != inherit_color else None
106
109
  break
107
110
 
108
111
  inner_nodes = [ render_node(node, color) for node in mod.schema_nodes ]
@@ -117,7 +120,7 @@ class Renderer:
117
120
  style="rounded"
118
121
  label = " {mod.name}"
119
122
  labeljust = "l"
120
- {(f'pencolor = "{color}"' if color else 'pencolor="#ccc"')}
123
+ {(f'pencolor = "{cluster_color}"' if cluster_color else 'pencolor="#ccc"')}
121
124
  {('penwidth = 3' if color else 'penwidth=""')}
122
125
  {inner_nodes_str}
123
126
  {child_str}
@@ -260,7 +260,7 @@ def update_forward_refs(kls):
260
260
 
261
261
  local_attrs = getattr(shelled_type, '__dict__', {})
262
262
  if local_attrs.get(const.PYDANTIC_FORWARD_REF_UPDATED, False):
263
- logger.debug(shelled_type.__qualname__, 'visited')
263
+ logger.debug("%s visited", shelled_type.__qualname__)
264
264
  continue
265
265
  if safe_issubclass(shelled_type, BaseModel):
266
266
  update_pydantic_forward_refs(shelled_type)
@@ -1,2 +1,2 @@
1
1
  __all__ = ["__version__"]
2
- __version__ = "0.12.3"
2
+ __version__ = "0.12.4"
@@ -0,0 +1,17 @@
1
+ const { defineComponent, computed } = window.Vue;
2
+
3
+ import { store } from '../store.js'
4
+
5
+ export default defineComponent({
6
+ name: "Demo",
7
+ emits: ["close"],
8
+ setup() {
9
+ return { store };
10
+ },
11
+ template: `
12
+ <div>
13
+ <p>Count: {{ store.state.count }}</p>
14
+ <button @click="store.mutations.increment()">Add</button>
15
+ </div>
16
+ `
17
+ });
@@ -132,7 +132,6 @@ export class GraphUI {
132
132
  });
133
133
 
134
134
  // svg 背景点击高亮清空
135
-
136
135
  $(document)
137
136
  .off("click.graphui")
138
137
  .on("click.graphui", function (evt) {
@@ -298,7 +298,7 @@
298
298
  <template #after>
299
299
  <div style="position: relative; width: 100%; height: 100%;">
300
300
  <div id="graph" class="adjust-fit"></div>
301
- <div style="position: absolute; left: 8px; bottom: 8px; z-index: 10; background: rgba(255,255,255,0.85); border-radius: 4px; padding: 2px 8px;">
301
+ <div style="position: absolute; left: 8px; top: 8px; z-index: 10; background: rgba(255,255,255,0.85); border-radius: 4px; padding: 2px 8px;">
302
302
  <div class="q-mt-sm">
303
303
  <q-toggle
304
304
  v-model="state.focus"
@@ -337,21 +337,25 @@
337
337
  title="show module cluster"
338
338
  />
339
339
  </div>
340
+ <div class="q-mt-sm">
341
+ <q-toggle
342
+ v-model="state.focus"
343
+ v-show="schemaCodeName"
344
+ @update:model-value="val => onFocusChange(val)"
345
+ label="Focus"
346
+ dense
347
+ title="pick a schema and toggle focus on to display related nodes only"
348
+ />
349
+ </div>
350
+ <!-- <div class="q-mt-sm">
351
+ <demo-component></demo-component>
352
+ </div> -->
340
353
  </div>
341
354
  </div>
342
355
  </template>
343
356
  </q-splitter>
344
357
  </q-page-container>
345
358
  </q-layout>
346
- <!-- Detail Dialog -->
347
- <q-dialog v-model="showDetail" :persistent="true" :maximized="true">
348
- <detail-dialog
349
- :schema-name="schemaName"
350
- :show-fields="state.showFields"
351
- :model-value="showDetail"
352
- @close="closeDetail"
353
- />
354
- </q-dialog>
355
359
 
356
360
  <!-- Schema Field Filter Dialog -->
357
361
  <q-dialog
@@ -0,0 +1,17 @@
1
+ const { reactive, watch, ref } = window.Vue;
2
+
3
+ const state = reactive({
4
+ count: 0
5
+ })
6
+
7
+ const mutations = {
8
+ increment() {
9
+ state.count += 1
10
+ }
11
+ }
12
+
13
+
14
+ export const store = {
15
+ state,
16
+ mutations
17
+ }
@@ -1,6 +1,7 @@
1
1
  import SchemaFieldFilter from "./component/schema-field-filter.js";
2
2
  import SchemaCodeDisplay from "./component/schema-code-display.js";
3
3
  import RouteCodeDisplay from "./component/route-code-display.js";
4
+ import Demo from './component/demo.js'
4
5
  import RenderGraph from "./component/render-graph.js";
5
6
  import { GraphUI } from "./graph-ui.js";
6
7
  const { createApp, reactive, onMounted, watch, ref } = window.Vue;
@@ -39,17 +40,22 @@ const app = createApp({
39
40
 
40
41
  const showDetail = ref(false);
41
42
  const showSchemaFieldFilter = ref(false);
43
+
42
44
  const showDumpDialog = ref(false);
43
45
  const dumpJson = ref("");
44
46
  const showImportDialog = ref(false);
45
47
  const importJsonText = ref("");
48
+
46
49
  const showRenderGraph = ref(false);
50
+
47
51
  const renderCoreData = ref(null);
52
+
48
53
  const schemaName = ref(""); // used by detail dialog
49
54
  const schemaFieldFilterSchema = ref(null); // external schemaName for schema-field-filter
50
55
  const schemaCodeName = ref("");
51
56
  const routeCodeId = ref("");
52
57
  const showRouteDetail = ref(false);
58
+
53
59
  let graphUI = null;
54
60
 
55
61
  function openDetail() {
@@ -435,13 +441,18 @@ const app = createApp({
435
441
  };
436
442
  },
437
443
  });
444
+
438
445
  app.use(window.Quasar);
446
+
439
447
  // Set Quasar primary theme color to green
440
448
  if (window.Quasar && typeof window.Quasar.setCssVar === "function") {
441
449
  window.Quasar.setCssVar("primary", "#009485");
442
450
  }
443
- app.component("schema-field-filter", SchemaFieldFilter);
444
- app.component("schema-code-display", SchemaCodeDisplay);
445
- app.component("route-code-display", RouteCodeDisplay);
446
- app.component("render-graph", RenderGraph);
451
+
452
+ app.component("schema-field-filter", SchemaFieldFilter); // shift click and see relationships
453
+ app.component("schema-code-display", SchemaCodeDisplay); // double click to see node details
454
+ app.component("route-code-display", RouteCodeDisplay); // double click to see route details
455
+ app.component("render-graph", RenderGraph); // for debug, render pasted dot content
456
+ app.component('demo-component', Demo)
457
+
447
458
  app.mount("#q-app");
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fastapi-voyager
3
- Version: 0.12.3
3
+ Version: 0.12.4
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
@@ -31,14 +31,31 @@ Description-Content-Type: text/markdown
31
31
  [![PyPI Downloads](https://static.pepy.tech/badge/fastapi-voyager/month)](https://pepy.tech/projects/fastapi-voyager)
32
32
 
33
33
 
34
- > This repo is still in early stage, it supports pydantic v2 only
35
34
 
36
35
  Visualize your FastAPI endpoints, and explore them interactively.
37
36
 
38
- [visit online demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
37
+ > This repo is still in early stage, it supports pydantic v2 only
38
+
39
+ [live demo](https://www.newsyeah.fun/voyager/) of project: [composition oriented development pattern](https://github.com/allmonday/composition-oriented-development-pattern)
39
40
 
40
41
  <img width="1600" height="986" alt="image" src="https://github.com/user-attachments/assets/8829cda0-f42d-4c84-be2f-b019bb5fe7e1" />
41
42
 
43
+ with configuration:
44
+
45
+ ```python
46
+ app.mount('/voyager',
47
+ create_voyager(
48
+ app,
49
+ module_color={'src.services': 'tomato'},
50
+ module_prefix='src.services',
51
+ swagger_url="/docs",
52
+ ga_id="G-R64S7Q49VL",
53
+ initial_page_policy='first',
54
+ online_repo_url='https://github.com/allmonday/composition-oriented-development-pattern/blob/master'))
55
+ ```
56
+
57
+ https://github.com/allmonday/composition-oriented-development-pattern/blob/master/src/main.py#L48
58
+
42
59
  ## Plan & Raodmap
43
60
  - [ideas](./docs/idea.md)
44
61
  - [changelog & roadmap](./docs/changelog.md)
@@ -2,19 +2,21 @@ fastapi_voyager/__init__.py,sha256=kqwzThE1YhmQ_7jPKGlnWvqRGC-hFrRqq_lKhKaleYU,2
2
2
  fastapi_voyager/cli.py,sha256=td3yIIigEomhSdDO-Xkh-CgpEwCafwlwnpvxnT9QsBo,10488
3
3
  fastapi_voyager/filter.py,sha256=AN_HIu8-DtKisIq5mFt7CnqRHtxKewedNGyyaI82hSY,11529
4
4
  fastapi_voyager/module.py,sha256=h9YR3BpS-CAcJW9WCdVkF4opqwY32w9T67g9GfdLytk,3425
5
- fastapi_voyager/render.py,sha256=1S9GFQ4LnNC_Qd-yiM8Jw8FkTxt2huREppc2sO0dFxA,9820
5
+ fastapi_voyager/render.py,sha256=7jSChISqTV2agaO55thhwyrOhqVOMux4x7k8rSQROnU,9960
6
6
  fastapi_voyager/server.py,sha256=MZNRpcXor2q8Rj3OSf6EH8NkgDChxfzUtnIY8ilRkaY,7053
7
7
  fastapi_voyager/type.py,sha256=7EL1zaIwKVRGpLig7fqaOrZGN5k0Rm31C9COfck3CSs,1750
8
- fastapi_voyager/type_helper.py,sha256=quQPV0dbb5JwpfpC5tL2Zad73f_fJXF2-k46ZMuXrZs,9716
9
- fastapi_voyager/version.py,sha256=TeMwxEaDOniKVMHjL1Q1lrmHL9cdAEzO838ewxqUUAU,49
8
+ fastapi_voyager/type_helper.py,sha256=JXD_OE_xTARkGjWDsnO_xfvyZ0vcwViYyqCp6oEHBTM,9719
9
+ fastapi_voyager/version.py,sha256=_-7Zp-y6CfERg3seD-eKm5cYiJTOf-VWfF-6iV8hzms,49
10
10
  fastapi_voyager/voyager.py,sha256=LiRUb0ZG2cfnyY_pwRqoeZjxb6Pu6xy_lqPiMupxoKM,13510
11
- fastapi_voyager/web/graph-ui.js,sha256=9ONPxQHvk4HxYq6KtKc_2VbJmUgd-gh7i3Biv1rkqC4,5734
11
+ fastapi_voyager/web/graph-ui.js,sha256=7ynB-o8Dse6WHWlp4bmuEfa1pUZJ2YFLJKKXjr4R6wU,5733
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
14
- fastapi_voyager/web/index.html,sha256=8cmlwQzE5tonHj_QozdKcr3z-7JFsvE7cjf70dye0y8,19377
14
+ fastapi_voyager/web/index.html,sha256=C8gqka2omSHqx40C5_CCSMKHP-VJSPV3UFTrqQHGRtU,19635
15
15
  fastapi_voyager/web/quasar.min.css,sha256=F5jQe7X2XT54VlvAaa2V3GsBFdVD-vxDZeaPLf6U9CU,203145
16
16
  fastapi_voyager/web/quasar.min.js,sha256=h0ftyPMW_CRiyzeVfQqiup0vrVt4_QWojpqmpnpn07E,502974
17
- fastapi_voyager/web/vue-main.js,sha256=m6U24ythzjQuAYXUm9BsTdFrApFNqW26B0Bf7TsybqQ,13275
17
+ fastapi_voyager/web/store.js,sha256=LPJdFxyFn8j7vOI41FKtWoB8agoqIUrR3tN5HRS_5e4,210
18
+ fastapi_voyager/web/vue-main.js,sha256=qTPJ2CTT5T9kRR2h0DbroOGJVePRIF3e24u7JexqjPQ,13516
19
+ fastapi_voyager/web/component/demo.js,sha256=FUwZqyMYjwf2J_YAzUBZ-gW9RFdOrz5zbxogBBYiYYE,347
18
20
  fastapi_voyager/web/component/render-graph.js,sha256=e8Xgh2Kl-nYU0P1gstEmAepCgFnk2J6UdxW8TlMafGs,2322
19
21
  fastapi_voyager/web/component/route-code-display.js,sha256=8NJPPjNRUC21gjpY8XYEQs4RBbhX1pCiqEhJp39ku6k,3678
20
22
  fastapi_voyager/web/component/schema-code-display.js,sha256=qKUMV2RFQzR8deof2iC4vyp65UaWadtVsDAXjY-i3vE,7042
@@ -26,8 +28,8 @@ fastapi_voyager/web/icon/favicon-16x16.png,sha256=JC07jEzfIYxBIoQn_FHXvyHuxESdhW
26
28
  fastapi_voyager/web/icon/favicon-32x32.png,sha256=C7v1h58cfWOsiLp9yOIZtlx-dLasBcq3NqpHVGRmpt4,1859
27
29
  fastapi_voyager/web/icon/favicon.ico,sha256=tZolYIXkkBcFiYl1A8ksaXN2VjGamzcSdes838dLvNc,15406
28
30
  fastapi_voyager/web/icon/site.webmanifest,sha256=ep4Hzh9zhmiZF2At3Fp1dQrYQuYF_3ZPZxc1KcGBvwQ,263
29
- fastapi_voyager-0.12.3.dist-info/METADATA,sha256=zCZqZOPMmQMh0guXA7dmVHP0QD1M8ZJKFT6dyR_hWRo,6009
30
- fastapi_voyager-0.12.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
31
- fastapi_voyager-0.12.3.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
32
- fastapi_voyager-0.12.3.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
33
- fastapi_voyager-0.12.3.dist-info/RECORD,,
31
+ fastapi_voyager-0.12.4.dist-info/METADATA,sha256=9VUoRQ9sMRLqvukIAlC7kUi1Bcf2raXR9v9JRx7Ltbk,6523
32
+ fastapi_voyager-0.12.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
33
+ fastapi_voyager-0.12.4.dist-info/entry_points.txt,sha256=pEIKoUnIDXEtdMBq8EmXm70m16vELIu1VPz9-TBUFWM,53
34
+ fastapi_voyager-0.12.4.dist-info/licenses/LICENSE,sha256=lNVRR3y_bFVoFKuK2JM8N4sFaj3m-7j29kvL3olFi5Y,1067
35
+ fastapi_voyager-0.12.4.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: hatchling 1.27.0
2
+ Generator: hatchling 1.28.0
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any