fastapi-deferred-init 0.3.1__tar.gz → 0.3.2__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_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/PKG-INFO +2 -2
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/pyproject.toml +2 -2
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/routing.py +12 -9
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/LICENSE +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/README.md +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/__init__.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/patch.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/py.typed +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/__init__.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/conftest.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/data/__init__.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/data/gen_code_ast.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/data/template.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/helpers.py +0 -0
- {fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/tests/test_lib.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastapi-deferred-init
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.2
|
|
4
4
|
Summary: Faster FastAPI start-up time for Projects with many nested routers
|
|
5
5
|
Keywords: fastapi,speed,router,startup,optimization
|
|
6
6
|
Author-Email: Jan Vollmer <jan@vllmr.dev>
|
|
@@ -18,7 +18,7 @@ Classifier: Typing :: Typed
|
|
|
18
18
|
Project-URL: Source, https://github.com/jvllmr/fastapi-deferred-init
|
|
19
19
|
Project-URL: Changelog, https://github.com/jvllmr/fastapi-deferred-init/releases
|
|
20
20
|
Requires-Python: >=3.10
|
|
21
|
-
Requires-Dist: fastapi>=0.
|
|
21
|
+
Requires-Dist: fastapi>=0.140.7
|
|
22
22
|
Description-Content-Type: text/markdown
|
|
23
23
|
|
|
24
24
|
# fastapi-deferred-init
|
|
@@ -12,7 +12,7 @@ authors = [
|
|
|
12
12
|
{ name = "Jan Vollmer", email = "jan@vllmr.dev" },
|
|
13
13
|
]
|
|
14
14
|
dependencies = [
|
|
15
|
-
"fastapi>=0.
|
|
15
|
+
"fastapi>=0.140.7",
|
|
16
16
|
]
|
|
17
17
|
requires-python = ">=3.10"
|
|
18
18
|
readme = "README.md"
|
|
@@ -29,7 +29,7 @@ classifiers = [
|
|
|
29
29
|
"Typing :: Typed",
|
|
30
30
|
]
|
|
31
31
|
dynamic = []
|
|
32
|
-
version = "0.3.
|
|
32
|
+
version = "0.3.2"
|
|
33
33
|
|
|
34
34
|
[project.license]
|
|
35
35
|
text = "MIT"
|
{fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/routing.py
RENAMED
|
@@ -10,17 +10,18 @@ from fastapi.sse import (
|
|
|
10
10
|
EventSourceResponse,
|
|
11
11
|
ServerSentEvent,
|
|
12
12
|
)
|
|
13
|
+
from fastapi.routing import _is_async_gen_callable, _is_gen_callable
|
|
13
14
|
from fastapi import params, routing # type: ignore[attr-defined]
|
|
14
15
|
from fastapi._compat import ModelField, lenient_issubclass
|
|
15
16
|
from fastapi.datastructures import Default, DefaultPlaceholder
|
|
16
17
|
from fastapi.dependencies.utils import (
|
|
17
18
|
_should_embed_body_fields,
|
|
18
|
-
|
|
19
|
+
_get_body_field,
|
|
19
20
|
get_dependant,
|
|
20
|
-
get_flat_dependant,
|
|
21
21
|
get_parameterless_sub_dependant,
|
|
22
22
|
get_typed_return_annotation,
|
|
23
23
|
get_stream_item_type,
|
|
24
|
+
_get_flat_body_params,
|
|
24
25
|
)
|
|
25
26
|
from fastapi.responses import JSONResponse, Response
|
|
26
27
|
from fastapi.types import IncEx
|
|
@@ -214,20 +215,20 @@ def _populate_api_route_state(
|
|
|
214
215
|
|
|
215
216
|
_add_cache_attribute(route, "dependant", _get_dependant)
|
|
216
217
|
|
|
217
|
-
def
|
|
218
|
-
return
|
|
218
|
+
def _flat_body_params(self) -> list[ModelField]:
|
|
219
|
+
return _get_flat_body_params(self.dependant)
|
|
219
220
|
|
|
220
|
-
_add_cache_attribute(route, "
|
|
221
|
+
_add_cache_attribute(route, "_flat_body_params", _flat_body_params)
|
|
221
222
|
|
|
222
223
|
def _embed_body_fields(self):
|
|
223
|
-
return _should_embed_body_fields(self.
|
|
224
|
+
return _should_embed_body_fields(self._flat_body_params)
|
|
224
225
|
|
|
225
226
|
_add_cache_attribute(route, "_embed_body_fields", _embed_body_fields)
|
|
226
227
|
|
|
227
228
|
def _body_field(self):
|
|
228
|
-
return
|
|
229
|
-
flat_dependant=self._flat_dependant,
|
|
229
|
+
return _get_body_field(
|
|
230
230
|
name=self.unique_id,
|
|
231
|
+
body_params=self._flat_body_params,
|
|
231
232
|
embed_body_fields=self._embed_body_fields,
|
|
232
233
|
)
|
|
233
234
|
|
|
@@ -235,7 +236,9 @@ def _populate_api_route_state(
|
|
|
235
236
|
|
|
236
237
|
# Detect generator endpoints that should stream as JSONL or SSE
|
|
237
238
|
def _is_generator(self) -> bool:
|
|
238
|
-
return self.dependant.
|
|
239
|
+
return _is_async_gen_callable(self.dependant.call) or _is_gen_callable(
|
|
240
|
+
self.dependant.call
|
|
241
|
+
)
|
|
239
242
|
|
|
240
243
|
_add_cache_attribute(route, "is_generator", _is_generator)
|
|
241
244
|
|
|
File without changes
|
|
File without changes
|
{fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/__init__.py
RENAMED
|
File without changes
|
{fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/patch.py
RENAMED
|
File without changes
|
{fastapi_deferred_init-0.3.1 → fastapi_deferred_init-0.3.2}/src/fastapi_deferred_init/py.typed
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
|