cuneus 0.2.3__tar.gz → 0.2.5__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.
- {cuneus-0.2.3 → cuneus-0.2.5}/PKG-INFO +1 -1
- {cuneus-0.2.3 → cuneus-0.2.5}/pyproject.toml +1 -1
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/cli.py +8 -5
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/application.py +16 -7
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/extensions.py +0 -2
- {cuneus-0.2.3 → cuneus-0.2.5}/uv.lock +1 -1
- {cuneus-0.2.3 → cuneus-0.2.5}/.gitignore +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/.python-version +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/README.md +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/__init__.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/__init__.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/execptions.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/logging.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/core/settings.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/ext/__init__.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/ext/health.py +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/src/cuneus/py.typed +0 -0
- {cuneus-0.2.3 → cuneus-0.2.5}/tests/test_integration.py +0 -0
|
@@ -13,9 +13,16 @@ from .core.settings import Settings
|
|
|
13
13
|
|
|
14
14
|
def import_from_string(import_str: str) -> Any:
|
|
15
15
|
"""Import an object from a module:attribute string."""
|
|
16
|
+
# Ensure cwd is in path for local imports
|
|
17
|
+
cwd = str(Path.cwd())
|
|
18
|
+
if cwd not in sys.path:
|
|
19
|
+
sys.path.insert(0, cwd)
|
|
20
|
+
|
|
16
21
|
module_path, _, attr = import_str.partition(":")
|
|
17
22
|
if not attr:
|
|
18
|
-
|
|
23
|
+
raise ValueError(
|
|
24
|
+
f"module_path missing function {import_str} expecting 'module.path:name'"
|
|
25
|
+
)
|
|
19
26
|
|
|
20
27
|
module = importlib.import_module(module_path)
|
|
21
28
|
return getattr(module, attr)
|
|
@@ -40,10 +47,6 @@ def get_user_cli() -> click.Group | None:
|
|
|
40
47
|
def cli(ctx: click.Context) -> None:
|
|
41
48
|
"""Cuneus CLI - FastAPI application framework."""
|
|
42
49
|
ctx.ensure_object(dict)
|
|
43
|
-
# Ensure cwd is in path for local imports
|
|
44
|
-
cwd = str(Path.cwd())
|
|
45
|
-
if cwd not in sys.path:
|
|
46
|
-
sys.path.insert(0, cwd)
|
|
47
50
|
|
|
48
51
|
|
|
49
52
|
@cli.command()
|
|
@@ -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
|
|
|
@@ -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]]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|