fastapi-voyager 0.15.6__tar.gz → 0.16.0a2__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 (116) hide show
  1. fastapi_voyager-0.15.6/README.md → fastapi_voyager-0.16.0a2/PKG-INFO +178 -5
  2. fastapi_voyager-0.15.6/PKG-INFO → fastapi_voyager-0.16.0a2/README.md +127 -34
  3. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/docs/changelog.md +8 -2
  4. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/pyproject.toml +38 -2
  5. fastapi_voyager-0.16.0a2/setup-django-ninja.sh +48 -0
  6. fastapi_voyager-0.16.0a2/setup-fastapi.sh +48 -0
  7. fastapi_voyager-0.16.0a2/setup-litestar.sh +48 -0
  8. fastapi_voyager-0.16.0a2/src/fastapi_voyager/__init__.py +8 -0
  9. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/__init__.py +16 -0
  10. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/base.py +44 -0
  11. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/common.py +260 -0
  12. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/django_ninja_adapter.py +299 -0
  13. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/fastapi_adapter.py +167 -0
  14. fastapi_voyager-0.16.0a2/src/fastapi_voyager/adapters/litestar_adapter.py +188 -0
  15. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/cli.py +11 -5
  16. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/er_diagram.py +15 -14
  17. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/__init__.py +34 -0
  18. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/base.py +81 -0
  19. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/detector.py +123 -0
  20. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/django_ninja.py +114 -0
  21. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/fastapi.py +94 -0
  22. fastapi_voyager-0.16.0a2/src/fastapi_voyager/introspectors/litestar.py +166 -0
  23. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/pydantic_resolve_util.py +4 -2
  24. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/render.py +2 -2
  25. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/render_style.py +0 -1
  26. fastapi_voyager-0.16.0a2/src/fastapi_voyager/server.py +181 -0
  27. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/type_helper.py +2 -2
  28. fastapi_voyager-0.16.0a2/src/fastapi_voyager/version.py +2 -0
  29. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/voyager.py +75 -47
  30. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/index.html +11 -14
  31. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/store.js +2 -0
  32. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/vue-main.js +4 -0
  33. fastapi_voyager-0.16.0a2/tests/README.md +150 -0
  34. fastapi_voyager-0.16.0a2/tests/django_ninja/__init__.py +5 -0
  35. fastapi_voyager-0.16.0a2/tests/django_ninja/demo.py +151 -0
  36. fastapi_voyager-0.16.0a2/tests/django_ninja/embedding.py +86 -0
  37. fastapi_voyager-0.16.0a2/tests/django_ninja/settings.py +48 -0
  38. fastapi_voyager-0.16.0a2/tests/django_ninja/urls.py +10 -0
  39. fastapi_voyager-0.16.0a2/tests/embedding_test_utils.py +147 -0
  40. fastapi_voyager-0.16.0a2/tests/fastapi/__init__.py +6 -0
  41. {fastapi_voyager-0.15.6/tests → fastapi_voyager-0.16.0a2/tests/fastapi}/demo.py +5 -6
  42. {fastapi_voyager-0.15.6/tests → fastapi_voyager-0.16.0a2/tests/fastapi}/demo_anno.py +1 -1
  43. fastapi_voyager-0.15.6/tests/programatic.py → fastapi_voyager-0.16.0a2/tests/fastapi/embedding.py +3 -2
  44. fastapi_voyager-0.16.0a2/tests/litestar/__init__.py +5 -0
  45. fastapi_voyager-0.16.0a2/tests/litestar/demo.py +132 -0
  46. fastapi_voyager-0.16.0a2/tests/litestar/embedding.py +89 -0
  47. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/service/schema/extra.py +1 -0
  48. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/service/schema/schema.py +4 -2
  49. fastapi_voyager-0.16.0a2/tests/test_embedding_django_ninja.py +82 -0
  50. fastapi_voyager-0.16.0a2/tests/test_embedding_fastapi.py +80 -0
  51. fastapi_voyager-0.16.0a2/tests/test_embedding_litestar.py +82 -0
  52. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_resolve_util_impl.py +3 -1
  53. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_type_helper.py +3 -1
  54. fastapi_voyager-0.16.0a2/uv.lock +1143 -0
  55. fastapi_voyager-0.15.6/src/fastapi_voyager/__init__.py +0 -8
  56. fastapi_voyager-0.15.6/src/fastapi_voyager/server.py +0 -302
  57. fastapi_voyager-0.15.6/src/fastapi_voyager/version.py +0 -2
  58. fastapi_voyager-0.15.6/uv.lock +0 -518
  59. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.githooks/README.md +0 -0
  60. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.githooks/pre-commit +0 -0
  61. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  62. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  63. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.github/workflows/publish.yml +0 -0
  64. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.gitignore +0 -0
  65. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.prettierignore +0 -0
  66. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.prettierrc +0 -0
  67. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/.python-version +0 -0
  68. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/CONTRIBUTING.md +0 -0
  69. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/LICENSE +0 -0
  70. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/docs/claude/0_REFACTORING_RENDER_NOTES.md +0 -0
  71. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/docs/idea.md +0 -0
  72. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/package-lock.json +0 -0
  73. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/release.md +0 -0
  74. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/setup-hooks.sh +0 -0
  75. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/filter.py +0 -0
  76. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/module.py +0 -0
  77. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/cluster.j2 +0 -0
  78. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/cluster_container.j2 +0 -0
  79. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/digraph.j2 +0 -0
  80. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/er_diagram.j2 +0 -0
  81. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/link.j2 +0 -0
  82. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/route_node.j2 +0 -0
  83. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/schema_node.j2 +0 -0
  84. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/dot/tag_node.j2 +0 -0
  85. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/html/colored_text.j2 +0 -0
  86. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/html/pydantic_meta.j2 +0 -0
  87. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/html/schema_field_row.j2 +0 -0
  88. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/html/schema_header.j2 +0 -0
  89. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/templates/html/schema_table.j2 +0 -0
  90. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/type.py +0 -0
  91. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/component/demo.js +0 -0
  92. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/component/render-graph.js +0 -0
  93. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/component/route-code-display.js +0 -0
  94. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/component/schema-code-display.js +0 -0
  95. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/graph-ui.js +0 -0
  96. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/graphviz.svg.css +0 -0
  97. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/graphviz.svg.js +0 -0
  98. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/android-chrome-192x192.png +0 -0
  99. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/android-chrome-512x512.png +0 -0
  100. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/apple-touch-icon.png +0 -0
  101. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/favicon-16x16.png +0 -0
  102. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/favicon-32x32.png +0 -0
  103. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/favicon.ico +0 -0
  104. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/icon/site.webmanifest +0 -0
  105. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/quasar.min.css +0 -0
  106. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/src/fastapi_voyager/web/quasar.min.js +0 -0
  107. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/__init__.py +0 -0
  108. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/service/__init__.py +0 -0
  109. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/service/schema/__init__.py +0 -0
  110. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/service/schema/base_entity.py +0 -0
  111. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_analysis.py +0 -0
  112. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_filter.py +0 -0
  113. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_generic.py +0 -0
  114. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_import.py +0 -0
  115. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/tests/test_module.py +0 -0
  116. {fastapi_voyager-0.15.6 → fastapi_voyager-0.16.0a2}/voyager.jpg +0 -0
@@ -1,3 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastapi-voyager
3
+ Version: 0.16.0a2
4
+ Summary: Visualize FastAPI application's routing tree and dependencies
5
+ Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
6
+ Project-URL: Source, https://github.com/allmonday/fastapi-voyager
7
+ Author-email: Tangkikodo <allmonday@126.com>
8
+ License: MIT
9
+ License-File: LICENSE
10
+ Keywords: fastapi,openapi,routing,visualization
11
+ Classifier: Framework :: FastAPI
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: jinja2>=3.0.0
22
+ Requires-Dist: pydantic-resolve>=2.4.3
23
+ Provides-Extra: all
24
+ Requires-Dist: django-ninja>=1.5.3; extra == 'all'
25
+ Requires-Dist: django>=4.2; extra == 'all'
26
+ Requires-Dist: fastapi>=0.110; extra == 'all'
27
+ Requires-Dist: httpx; extra == 'all'
28
+ Requires-Dist: litestar>=2.19.0; extra == 'all'
29
+ Requires-Dist: pydantic>=2.0; extra == 'all'
30
+ Requires-Dist: pytest; extra == 'all'
31
+ Requires-Dist: pytest-asyncio; extra == 'all'
32
+ Requires-Dist: ruff; extra == 'all'
33
+ Requires-Dist: uvicorn; extra == 'all'
34
+ Provides-Extra: dev
35
+ Requires-Dist: httpx; extra == 'dev'
36
+ Requires-Dist: pytest; extra == 'dev'
37
+ Requires-Dist: pytest-asyncio; extra == 'dev'
38
+ Requires-Dist: ruff; extra == 'dev'
39
+ Provides-Extra: django-ninja
40
+ Requires-Dist: django-ninja>=1.5.3; extra == 'django-ninja'
41
+ Requires-Dist: django>=4.2; extra == 'django-ninja'
42
+ Requires-Dist: uvicorn; extra == 'django-ninja'
43
+ Provides-Extra: fastapi
44
+ Requires-Dist: fastapi>=0.110; extra == 'fastapi'
45
+ Requires-Dist: uvicorn; extra == 'fastapi'
46
+ Provides-Extra: litestar
47
+ Requires-Dist: litestar>=2.19.0; extra == 'litestar'
48
+ Requires-Dist: pydantic>=2.0; extra == 'litestar'
49
+ Requires-Dist: uvicorn; extra == 'litestar'
50
+ Description-Content-Type: text/markdown
51
+
1
52
  [![pypi](https://img.shields.io/pypi/v/fastapi-voyager.svg)](https://pypi.python.org/pypi/fastapi-voyager)
2
53
  ![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-voyager)
3
54
  [![PyPI Downloads](https://static.pepy.tech/badge/fastapi-voyager/month)](https://pepy.tech/projects/fastapi-voyager)
@@ -5,10 +56,12 @@
5
56
 
6
57
  # FastAPI Voyager
7
58
 
8
- Visualize your FastAPI endpoints and explore them interactively.
59
+ Visualize your API endpoints and explore them interactively.
9
60
 
10
61
  Its vision is to make code easier to read and understand, serving as an ideal documentation tool.
11
62
 
63
+ **Now supports multiple frameworks:** FastAPI, Django Ninja, and Litestar.
64
+
12
65
  > This repo is still in early stage, it supports Pydantic v2 only.
13
66
 
14
67
  - **Live Demo**: https://www.newsyeah.fun/voyager/
@@ -20,6 +73,7 @@ Its vision is to make code easier to read and understand, serving as an ideal do
20
73
 
21
74
  - [Quick Start](#quick-start)
22
75
  - [Installation](#installation)
76
+ - [Supported Frameworks](#supported-frameworks)
23
77
  - [Features](#features)
24
78
  - [Command Line Usage](#command-line-usage)
25
79
  - [About pydantic-resolve](#about-pydantic-resolve)
@@ -29,7 +83,7 @@ Its vision is to make code easier to read and understand, serving as an ideal do
29
83
 
30
84
  ## Quick Start
31
85
 
32
- With simple configuration, fastapi-voyager can be embedded into FastAPI:
86
+ With simple configuration, fastapi-voyager can be embedded into your web application:
33
87
 
34
88
  ```python
35
89
  from fastapi import FastAPI
@@ -37,6 +91,8 @@ from fastapi_voyager import create_voyager
37
91
 
38
92
  app = FastAPI()
39
93
 
94
+ # ... define your routes ...
95
+
40
96
  app.mount('/voyager',
41
97
  create_voyager(
42
98
  app,
@@ -45,12 +101,14 @@ app.mount('/voyager',
45
101
  swagger_url="/docs",
46
102
  ga_id="G-XXXXXXXXVL",
47
103
  initial_page_policy='first',
48
- online_repo_url='https://github.com/allmonday/composition-oriented-development-pattern/blob/master',
104
+ online_repo_url='https://github.com/your-org/your-repo/blob/master',
49
105
  enable_pydantic_resolve_meta=True))
50
106
  ```
51
107
 
52
108
  Visit `http://localhost:8000/voyager` to explore your API visually.
53
109
 
110
+ For framework-specific examples (Django Ninja, Litestar), see [Supported Frameworks](#supported-frameworks).
111
+
54
112
  [View full example](https://github.com/allmonday/composition-oriented-development-pattern/blob/master/src/main.py#L48)
55
113
 
56
114
  ## Installation
@@ -81,9 +139,106 @@ voyager -m path.to.your.app.module --server --app api
81
139
 
82
140
  > **Note**: [Sub-Application mounts](https://fastapi.tiangolo.com/advanced/sub-applications/) are not supported yet, but you can specify the name of the FastAPI application with `--app`. Only a single application (default: `app`) can be selected.
83
141
 
142
+ ## Supported Frameworks
143
+
144
+ fastapi-voyager automatically detects your framework and provides the appropriate integration. Currently supported frameworks:
145
+
146
+ ### FastAPI
147
+
148
+ ```python
149
+ from fastapi import FastAPI
150
+ from fastapi_voyager import create_voyager
151
+
152
+ app = FastAPI()
153
+
154
+ @app.get("/hello")
155
+ def hello():
156
+ return {"message": "Hello World"}
157
+
158
+ # Mount voyager
159
+ app.mount("/voyager", create_voyager(app))
160
+ ```
161
+
162
+ Start with:
163
+ ```bash
164
+ uvicorn your_app:app --reload
165
+ # Visit http://localhost:8000/voyager
166
+ ```
167
+
168
+ ### Django Ninja
169
+
170
+ ```python
171
+ import os
172
+ import django
173
+ from django.core.asgi import get_asgi_application
174
+ from ninja import NinjaAPI
175
+ from fastapi_voyager import create_voyager
176
+
177
+ # Configure Django
178
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
179
+ django.setup()
180
+
181
+ # Create Django Ninja API
182
+ api = NinjaAPI()
183
+
184
+ @api.get("/hello")
185
+ def hello(request):
186
+ return {"message": "Hello World"}
187
+
188
+ # Create voyager ASGI app
189
+ voyager_app = create_voyager(api)
190
+
191
+ # Create ASGI application that routes between Django and voyager
192
+ async def application(scope, receive, send):
193
+ if scope["type"] == "http" and scope["path"].startswith("/voyager"):
194
+ await voyager_app(scope, receive, send)
195
+ else:
196
+ django_app = get_asgi_application()
197
+ await django_app(scope, receive, send)
198
+ ```
199
+
200
+ Start with:
201
+ ```bash
202
+ uvicorn your_app:application --reload
203
+ # Visit http://localhost:8000/voyager
204
+ ```
205
+
206
+ ### Litestar
207
+
208
+ ```python
209
+ from litestar import Litestar, get
210
+ from fastapi_voyager import create_voyager
211
+
212
+ # Create Litestar app
213
+ app = Litestar()
214
+
215
+ @get("/hello")
216
+ def hello() -> dict:
217
+ return {"message": "Hello World"}
218
+
219
+ # Create voyager app (returns a Litestar app)
220
+ voyager_app = create_voyager(app)
221
+
222
+ # Create ASGI application that routes between main app and voyager
223
+ async def asgi_app(scope, receive, send):
224
+ if scope["type"] == "http" and scope["path"].startswith("/voyager"):
225
+ # Remove /voyager prefix for voyager app
226
+ new_scope = dict(scope)
227
+ new_scope["path"] = scope["path"][8:] or "/"
228
+ await voyager_app(new_scope, receive, send)
229
+ else:
230
+ await app(scope, receive, send)
231
+ ```
232
+
233
+ Start with:
234
+ ```bash
235
+ uvicorn your_app:asgi_app --reload
236
+ # Visit http://localhost:8000/voyager
237
+ ```
238
+
84
239
  ## Features
85
240
 
86
- fastapi-voyager is designed for scenarios using FastAPI as internal API integration endpoints. It helps visualize dependencies and serves as an architecture tool to identify implementation issues such as wrong relationships, overfetching, and more.
241
+ fastapi-voyager is designed for scenarios using web frameworks with Pydantic models (FastAPI, Django Ninja, Litestar). It helps visualize dependencies and serves as an architecture tool to identify implementation issues such as wrong relationships, overfetching, and more.
87
242
 
88
243
  **Best Practice**: When building view models following the ER model pattern, fastapi-voyager can fully realize its potential - quickly identifying which APIs use specific entities and vice versa.
89
244
 
@@ -229,6 +384,21 @@ uv pip install ".[dev]"
229
384
  uvicorn tests.programatic:app --reload
230
385
  ```
231
386
 
387
+ ### Test Different Frameworks
388
+
389
+ You can test the framework-specific examples:
390
+
391
+ ```bash
392
+ # FastAPI example
393
+ uvicorn tests.fastapi.embedding:app --reload
394
+
395
+ # Django Ninja example
396
+ uvicorn tests.django_ninja.embedding:app --reload
397
+
398
+ # Litestar example
399
+ uvicorn tests.litestar.embedding:asgi_app --reload
400
+ ```
401
+
232
402
  Visit `http://localhost:8000/voyager` to see changes.
233
403
 
234
404
  ### Setup Git Hooks (Optional)
@@ -260,9 +430,12 @@ This will run Prettier automatically before each commit. See [`.githooks/README.
260
430
 
261
431
  ## Dependencies
262
432
 
263
- - [FastAPI](https://fastapi.tiangolo.com/)
264
433
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
265
434
  - [Quasar Framework](https://quasar.dev/)
435
+ ### Dev dependencies
436
+ - [FastAPI](https://fastapi.tiangolo.com/)
437
+ - [Django Ninja](https://django-ninja.rest-framework.com/)
438
+ - [Litestar](https://litestar.dev/)
266
439
 
267
440
  ## Credits
268
441
 
@@ -1,32 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: fastapi-voyager
3
- Version: 0.15.6
4
- Summary: Visualize FastAPI application's routing tree and dependencies
5
- Project-URL: Homepage, https://github.com/allmonday/fastapi-voyager
6
- Project-URL: Source, https://github.com/allmonday/fastapi-voyager
7
- Author-email: Tangkikodo <allmonday@126.com>
8
- License: MIT
9
- License-File: LICENSE
10
- Keywords: fastapi,openapi,routing,visualization
11
- Classifier: Framework :: FastAPI
12
- Classifier: Intended Audience :: Developers
13
- Classifier: License :: OSI Approved :: MIT License
14
- Classifier: Programming Language :: Python :: 3
15
- Classifier: Programming Language :: Python :: 3.10
16
- Classifier: Programming Language :: Python :: 3.11
17
- Classifier: Programming Language :: Python :: 3.12
18
- Classifier: Programming Language :: Python :: 3.13
19
- Classifier: Programming Language :: Python :: 3.14
20
- Requires-Python: >=3.10
21
- Requires-Dist: fastapi>=0.110
22
- Requires-Dist: jinja2>=3.0.0
23
- Requires-Dist: pydantic-resolve>=2.4.3
24
- Provides-Extra: dev
25
- Requires-Dist: pytest; extra == 'dev'
26
- Requires-Dist: ruff; extra == 'dev'
27
- Requires-Dist: uvicorn; extra == 'dev'
28
- Description-Content-Type: text/markdown
29
-
30
1
  [![pypi](https://img.shields.io/pypi/v/fastapi-voyager.svg)](https://pypi.python.org/pypi/fastapi-voyager)
31
2
  ![Python Versions](https://img.shields.io/pypi/pyversions/fastapi-voyager)
32
3
  [![PyPI Downloads](https://static.pepy.tech/badge/fastapi-voyager/month)](https://pepy.tech/projects/fastapi-voyager)
@@ -34,10 +5,12 @@ Description-Content-Type: text/markdown
34
5
 
35
6
  # FastAPI Voyager
36
7
 
37
- Visualize your FastAPI endpoints and explore them interactively.
8
+ Visualize your API endpoints and explore them interactively.
38
9
 
39
10
  Its vision is to make code easier to read and understand, serving as an ideal documentation tool.
40
11
 
12
+ **Now supports multiple frameworks:** FastAPI, Django Ninja, and Litestar.
13
+
41
14
  > This repo is still in early stage, it supports Pydantic v2 only.
42
15
 
43
16
  - **Live Demo**: https://www.newsyeah.fun/voyager/
@@ -49,6 +22,7 @@ Its vision is to make code easier to read and understand, serving as an ideal do
49
22
 
50
23
  - [Quick Start](#quick-start)
51
24
  - [Installation](#installation)
25
+ - [Supported Frameworks](#supported-frameworks)
52
26
  - [Features](#features)
53
27
  - [Command Line Usage](#command-line-usage)
54
28
  - [About pydantic-resolve](#about-pydantic-resolve)
@@ -58,7 +32,7 @@ Its vision is to make code easier to read and understand, serving as an ideal do
58
32
 
59
33
  ## Quick Start
60
34
 
61
- With simple configuration, fastapi-voyager can be embedded into FastAPI:
35
+ With simple configuration, fastapi-voyager can be embedded into your web application:
62
36
 
63
37
  ```python
64
38
  from fastapi import FastAPI
@@ -66,6 +40,8 @@ from fastapi_voyager import create_voyager
66
40
 
67
41
  app = FastAPI()
68
42
 
43
+ # ... define your routes ...
44
+
69
45
  app.mount('/voyager',
70
46
  create_voyager(
71
47
  app,
@@ -74,12 +50,14 @@ app.mount('/voyager',
74
50
  swagger_url="/docs",
75
51
  ga_id="G-XXXXXXXXVL",
76
52
  initial_page_policy='first',
77
- online_repo_url='https://github.com/allmonday/composition-oriented-development-pattern/blob/master',
53
+ online_repo_url='https://github.com/your-org/your-repo/blob/master',
78
54
  enable_pydantic_resolve_meta=True))
79
55
  ```
80
56
 
81
57
  Visit `http://localhost:8000/voyager` to explore your API visually.
82
58
 
59
+ For framework-specific examples (Django Ninja, Litestar), see [Supported Frameworks](#supported-frameworks).
60
+
83
61
  [View full example](https://github.com/allmonday/composition-oriented-development-pattern/blob/master/src/main.py#L48)
84
62
 
85
63
  ## Installation
@@ -110,9 +88,106 @@ voyager -m path.to.your.app.module --server --app api
110
88
 
111
89
  > **Note**: [Sub-Application mounts](https://fastapi.tiangolo.com/advanced/sub-applications/) are not supported yet, but you can specify the name of the FastAPI application with `--app`. Only a single application (default: `app`) can be selected.
112
90
 
91
+ ## Supported Frameworks
92
+
93
+ fastapi-voyager automatically detects your framework and provides the appropriate integration. Currently supported frameworks:
94
+
95
+ ### FastAPI
96
+
97
+ ```python
98
+ from fastapi import FastAPI
99
+ from fastapi_voyager import create_voyager
100
+
101
+ app = FastAPI()
102
+
103
+ @app.get("/hello")
104
+ def hello():
105
+ return {"message": "Hello World"}
106
+
107
+ # Mount voyager
108
+ app.mount("/voyager", create_voyager(app))
109
+ ```
110
+
111
+ Start with:
112
+ ```bash
113
+ uvicorn your_app:app --reload
114
+ # Visit http://localhost:8000/voyager
115
+ ```
116
+
117
+ ### Django Ninja
118
+
119
+ ```python
120
+ import os
121
+ import django
122
+ from django.core.asgi import get_asgi_application
123
+ from ninja import NinjaAPI
124
+ from fastapi_voyager import create_voyager
125
+
126
+ # Configure Django
127
+ os.environ.setdefault("DJANGO_SETTINGS_MODULE", "myapp.settings")
128
+ django.setup()
129
+
130
+ # Create Django Ninja API
131
+ api = NinjaAPI()
132
+
133
+ @api.get("/hello")
134
+ def hello(request):
135
+ return {"message": "Hello World"}
136
+
137
+ # Create voyager ASGI app
138
+ voyager_app = create_voyager(api)
139
+
140
+ # Create ASGI application that routes between Django and voyager
141
+ async def application(scope, receive, send):
142
+ if scope["type"] == "http" and scope["path"].startswith("/voyager"):
143
+ await voyager_app(scope, receive, send)
144
+ else:
145
+ django_app = get_asgi_application()
146
+ await django_app(scope, receive, send)
147
+ ```
148
+
149
+ Start with:
150
+ ```bash
151
+ uvicorn your_app:application --reload
152
+ # Visit http://localhost:8000/voyager
153
+ ```
154
+
155
+ ### Litestar
156
+
157
+ ```python
158
+ from litestar import Litestar, get
159
+ from fastapi_voyager import create_voyager
160
+
161
+ # Create Litestar app
162
+ app = Litestar()
163
+
164
+ @get("/hello")
165
+ def hello() -> dict:
166
+ return {"message": "Hello World"}
167
+
168
+ # Create voyager app (returns a Litestar app)
169
+ voyager_app = create_voyager(app)
170
+
171
+ # Create ASGI application that routes between main app and voyager
172
+ async def asgi_app(scope, receive, send):
173
+ if scope["type"] == "http" and scope["path"].startswith("/voyager"):
174
+ # Remove /voyager prefix for voyager app
175
+ new_scope = dict(scope)
176
+ new_scope["path"] = scope["path"][8:] or "/"
177
+ await voyager_app(new_scope, receive, send)
178
+ else:
179
+ await app(scope, receive, send)
180
+ ```
181
+
182
+ Start with:
183
+ ```bash
184
+ uvicorn your_app:asgi_app --reload
185
+ # Visit http://localhost:8000/voyager
186
+ ```
187
+
113
188
  ## Features
114
189
 
115
- fastapi-voyager is designed for scenarios using FastAPI as internal API integration endpoints. It helps visualize dependencies and serves as an architecture tool to identify implementation issues such as wrong relationships, overfetching, and more.
190
+ fastapi-voyager is designed for scenarios using web frameworks with Pydantic models (FastAPI, Django Ninja, Litestar). It helps visualize dependencies and serves as an architecture tool to identify implementation issues such as wrong relationships, overfetching, and more.
116
191
 
117
192
  **Best Practice**: When building view models following the ER model pattern, fastapi-voyager can fully realize its potential - quickly identifying which APIs use specific entities and vice versa.
118
193
 
@@ -258,6 +333,21 @@ uv pip install ".[dev]"
258
333
  uvicorn tests.programatic:app --reload
259
334
  ```
260
335
 
336
+ ### Test Different Frameworks
337
+
338
+ You can test the framework-specific examples:
339
+
340
+ ```bash
341
+ # FastAPI example
342
+ uvicorn tests.fastapi.embedding:app --reload
343
+
344
+ # Django Ninja example
345
+ uvicorn tests.django_ninja.embedding:app --reload
346
+
347
+ # Litestar example
348
+ uvicorn tests.litestar.embedding:asgi_app --reload
349
+ ```
350
+
261
351
  Visit `http://localhost:8000/voyager` to see changes.
262
352
 
263
353
  ### Setup Git Hooks (Optional)
@@ -289,9 +379,12 @@ This will run Prettier automatically before each commit. See [`.githooks/README.
289
379
 
290
380
  ## Dependencies
291
381
 
292
- - [FastAPI](https://fastapi.tiangolo.com/)
293
382
  - [pydantic-resolve](https://github.com/allmonday/pydantic-resolve)
294
383
  - [Quasar Framework](https://quasar.dev/)
384
+ ### Dev dependencies
385
+ - [FastAPI](https://fastapi.tiangolo.com/)
386
+ - [Django Ninja](https://django-ninja.rest-framework.com/)
387
+ - [Litestar](https://litestar.dev/)
295
388
 
296
389
  ## Credits
297
390
 
@@ -176,8 +176,14 @@
176
176
  - [x] internal refactor: graph-ui.js
177
177
  - [x] enhance the selected and unselected node & edges
178
178
 
179
- ## 0.16, enhance er diagram
180
- - 0.16.0
179
+ ## 0.16
180
+ - 0.16.0alpha-1
181
+ - [x] support django ninja and litestar
182
+ - 0.16.0alpha-2
183
+ - [x] fix import error
184
+
185
+ ## 0.17, enhance er diagram
186
+ - 0.17.0
181
187
  - [ ] show loader name
182
188
  - [ ] show relationship list when double click entity in er diagram
183
189
  - [ ] highlight entity in use case
@@ -8,7 +8,6 @@ readme = "README.md"
8
8
  requires-python = ">=3.10"
9
9
  keywords = ["fastapi", "visualization", "routing", "openapi"]
10
10
  dependencies = [
11
- "fastapi>=0.110",
12
11
  "pydantic-resolve>=2.4.3",
13
12
  "jinja2>=3.0.0"
14
13
  ]
@@ -32,7 +31,11 @@ Homepage = "https://github.com/allmonday/fastapi-voyager"
32
31
  Source = "https://github.com/allmonday/fastapi-voyager"
33
32
 
34
33
  [project.optional-dependencies]
35
- dev = ["uvicorn", "ruff", "pytest"]
34
+ dev = ["ruff", "pytest", "pytest-asyncio", "httpx"]
35
+ fastapi = ["fastapi>=0.110", "uvicorn"]
36
+ django-ninja = ["django>=4.2", "django-ninja>=1.5.3", "uvicorn"]
37
+ litestar = ["litestar>=2.19.0", "pydantic>=2.0", "uvicorn"]
38
+ all = ["fastapi-voyager[dev,fastapi,django-ninja,litestar]"]
36
39
 
37
40
  [build-system]
38
41
  requires = ["hatchling"]
@@ -41,6 +44,9 @@ build-backend = "hatchling.build"
41
44
  [tool.hatch.version]
42
45
  path = "src/fastapi_voyager/version.py"
43
46
 
47
+ [tool.hatch.build.targets.wheel]
48
+ packages = ["src/fastapi_voyager"]
49
+
44
50
  [tool.uv]
45
51
  # You can pin resolution or indexes here later.
46
52
 
@@ -49,3 +55,33 @@ line-length = 100
49
55
 
50
56
  [tool.ruff.lint]
51
57
  select = ["E", "F", "I", "UP", "B"]
58
+
59
+ [dependency-groups]
60
+ dev = [
61
+ "httpx>=0.28.1",
62
+ "pytest-asyncio>=1.3.0",
63
+ "pytest>=8.0.0",
64
+ "ruff>=0.9.0",
65
+ ]
66
+ fastapi = [
67
+ "fastapi>=0.116.1",
68
+ "uvicorn>=0.34.0",
69
+ ]
70
+ django-ninja = [
71
+ "django>=4.2",
72
+ "django-ninja>=1.5.3",
73
+ "uvicorn>=0.34.0",
74
+ ]
75
+ litestar = [
76
+ "litestar>=2.19.0",
77
+ "pydantic>=2.0",
78
+ "uvicorn>=0.34.0",
79
+ ]
80
+ all = [
81
+ "django>=4.2",
82
+ "django-ninja>=1.5.3",
83
+ "fastapi>=0.116.1",
84
+ "litestar>=2.19.0",
85
+ "pydantic>=2.0",
86
+ "uvicorn>=0.34.0",
87
+ ]
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+ # Django Ninja Development Setup Script
3
+ # Usage: ./setup-django-ninja.sh [--no-sync]
4
+
5
+ set -e
6
+
7
+ echo "🚀 Setting up Django Ninja development environment..."
8
+ echo ""
9
+
10
+ # Parse arguments
11
+ SYNC=true
12
+ for arg in "$@"; do
13
+ case $arg in
14
+ --no-sync)
15
+ SYNC=false
16
+ shift
17
+ ;;
18
+ esac
19
+ done
20
+
21
+ # Sync dependencies
22
+ if [ "$SYNC" = true ]; then
23
+ echo "📦 Syncing dependencies..."
24
+ uv sync --group dev --group django-ninja
25
+ echo "✅ Dependencies synced"
26
+ echo ""
27
+ fi
28
+
29
+ # Check if uvicorn is installed
30
+ echo "🔍 Checking uvicorn installation..."
31
+ if uv run which uvicorn > /dev/null 2>&1; then
32
+ UVICORN_PATH=$(uv run which uvicorn)
33
+ echo "✅ Uvicorn found at: $UVICORN_PATH"
34
+ else
35
+ echo "❌ Uvicorn not found in project environment"
36
+ exit 1
37
+ fi
38
+ echo ""
39
+
40
+ # Start Django Ninja server
41
+ echo "🌟 Starting Django Ninja Voyager server..."
42
+ echo " App: tests.django_ninja.embedding:application"
43
+ echo " URL: http://127.0.0.1:8000"
44
+ echo ""
45
+ echo "Press Ctrl+C to stop the server"
46
+ echo ""
47
+
48
+ uv run uvicorn tests.django_ninja.embedding:application --reload --host 127.0.0.1 --port 8000
@@ -0,0 +1,48 @@
1
+ #!/bin/bash
2
+ # FastAPI Development Setup Script
3
+ # Usage: ./setup-fastapi.sh [--no-sync]
4
+
5
+ set -e
6
+
7
+ echo "🚀 Setting up FastAPI development environment..."
8
+ echo ""
9
+
10
+ # Parse arguments
11
+ SYNC=true
12
+ for arg in "$@"; do
13
+ case $arg in
14
+ --no-sync)
15
+ SYNC=false
16
+ shift
17
+ ;;
18
+ esac
19
+ done
20
+
21
+ # Sync dependencies
22
+ if [ "$SYNC" = true ]; then
23
+ echo "📦 Syncing dependencies..."
24
+ uv sync --group dev --group fastapi
25
+ echo "✅ Dependencies synced"
26
+ echo ""
27
+ fi
28
+
29
+ # Check if uvicorn is installed
30
+ echo "🔍 Checking uvicorn installation..."
31
+ if uv run which uvicorn > /dev/null 2>&1; then
32
+ UVICORN_PATH=$(uv run which uvicorn)
33
+ echo "✅ Uvicorn found at: $UVICORN_PATH"
34
+ else
35
+ echo "❌ Uvicorn not found in project environment"
36
+ exit 1
37
+ fi
38
+ echo ""
39
+
40
+ # Start FastAPI server
41
+ echo "🌟 Starting FastAPI Voyager server..."
42
+ echo " App: tests.fastapi.embedding:app"
43
+ echo " URL: http://127.0.0.1:8000"
44
+ echo ""
45
+ echo "Press Ctrl+C to stop the server"
46
+ echo ""
47
+
48
+ uv run uvicorn tests.fastapi.embedding:app --reload --host 127.0.0.1 --port 8000