cuneus 0.2.4__py3-none-any.whl → 0.2.5__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.
- cuneus/core/application.py +16 -7
- cuneus/core/extensions.py +0 -2
- {cuneus-0.2.4.dist-info → cuneus-0.2.5.dist-info}/METADATA +1 -1
- {cuneus-0.2.4.dist-info → cuneus-0.2.5.dist-info}/RECORD +6 -6
- {cuneus-0.2.4.dist-info → cuneus-0.2.5.dist-info}/WHEEL +0 -0
- {cuneus-0.2.4.dist-info → cuneus-0.2.5.dist-info}/entry_points.txt +0 -0
cuneus/core/application.py
CHANGED
|
@@ -6,6 +6,7 @@ Lightweight lifespan management for FastAPI applications.
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
+
import inspect
|
|
9
10
|
from contextlib import AsyncExitStack, asynccontextmanager
|
|
10
11
|
from typing import Any, AsyncIterator, Callable
|
|
11
12
|
|
|
@@ -33,13 +34,21 @@ DEFAULT_EXTENSIONS = (
|
|
|
33
34
|
def _instantiate_extension(
|
|
34
35
|
ext: ExtensionInput, settings: Settings | None = None
|
|
35
36
|
) -> Extension:
|
|
36
|
-
if isinstance(ext, type):
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
if isinstance(ext, type) or callable(ext):
|
|
38
|
+
sig = inspect.signature(ext)
|
|
39
|
+
|
|
40
|
+
# Check if it accepts a 'settings' parameter
|
|
41
|
+
if "settings" in sig.parameters:
|
|
42
|
+
return ext(settings=settings)
|
|
43
|
+
|
|
44
|
+
# Check if it accepts **kwargs
|
|
45
|
+
has_var_keyword = any(
|
|
46
|
+
p.kind == inspect.Parameter.VAR_KEYWORD for p in sig.parameters.values()
|
|
47
|
+
)
|
|
48
|
+
if has_var_keyword:
|
|
49
|
+
return ext(settings=settings)
|
|
50
|
+
|
|
51
|
+
return ext()
|
|
43
52
|
return ext
|
|
44
53
|
|
|
45
54
|
|
cuneus/core/extensions.py
CHANGED
|
@@ -33,8 +33,6 @@ class Extension(Protocol):
|
|
|
33
33
|
- Return state to merge into lifespan state
|
|
34
34
|
"""
|
|
35
35
|
|
|
36
|
-
def __init__(self, settings: Settings | None = None) -> None: ...
|
|
37
|
-
|
|
38
36
|
def register(
|
|
39
37
|
self, registry: svcs.Registry, app: FastAPI
|
|
40
38
|
) -> AsyncContextManager[dict[str, Any]]:
|
|
@@ -2,14 +2,14 @@ cuneus/__init__.py,sha256=JJ3nZ4757GU9KKuurxP1FfJSdSVrcO-xaorLFSvUJ5E,1211
|
|
|
2
2
|
cuneus/cli.py,sha256=NHk_hI_KtXPQ0EXCCfottDwOFrSG6vcYSZPrzuzyZk8,3715
|
|
3
3
|
cuneus/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
4
|
cuneus/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
-
cuneus/core/application.py,sha256=
|
|
5
|
+
cuneus/core/application.py,sha256=6yKbrkkSaWlt3UHiKo68Dc9B1EAcNXd6BxO5W8ZTZuc,4058
|
|
6
6
|
cuneus/core/execptions.py,sha256=beQE3gD-14BUK4Se6yE2J2U92xgr0yarVmVeibkudxs,5753
|
|
7
|
-
cuneus/core/extensions.py,sha256=
|
|
7
|
+
cuneus/core/extensions.py,sha256=qqBnAD_wN6wTTun7C2hfVqxHhA3WgScNSrgRTMsYa04,2515
|
|
8
8
|
cuneus/core/logging.py,sha256=OlcWxBCLDqBORzTXZXKlMc_rGD8OkfOBfHgSwEpMCM4,6778
|
|
9
9
|
cuneus/core/settings.py,sha256=PaYXQ_ubeSt3AFpxNNErii-h1_ehHYPrajFWRT42mTI,1703
|
|
10
10
|
cuneus/ext/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
11
|
cuneus/ext/health.py,sha256=5dWVVEPFL1tWFBhQwZv8C-IvZRzg28V-4sk_g1jJ0vc,3854
|
|
12
|
-
cuneus-0.2.
|
|
13
|
-
cuneus-0.2.
|
|
14
|
-
cuneus-0.2.
|
|
15
|
-
cuneus-0.2.
|
|
12
|
+
cuneus-0.2.5.dist-info/METADATA,sha256=hIVlKfIT3uwqzSeoX8nXeEN6oCnfKcb5HaT-y3YETBQ,6794
|
|
13
|
+
cuneus-0.2.5.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
14
|
+
cuneus-0.2.5.dist-info/entry_points.txt,sha256=tzPgom-_UkpP_uLKv3V_XyoIsKg84FBAc9ddjYl0W0Y,43
|
|
15
|
+
cuneus-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|