turbo-lambda 0.7.1__tar.gz → 0.8.0__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.
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/PKG-INFO +2 -2
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/pyproject.toml +2 -2
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/log.py +17 -5
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/README.md +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/__init__.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/decorators.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/errors.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/py.typed +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/schemas.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/scripts/__init__.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/scripts/update_turbo_lambda_layer.py +0 -0
- {turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/version.py +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: turbo-lambda
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Turbo Lambda Description
|
|
5
5
|
Author: Sam Mosleh
|
|
6
6
|
Author-email: Sam Mosleh <sam.mosleh.d@gmail.com>
|
|
7
7
|
Requires-Dist: opentelemetry-api>=1.27.0
|
|
8
8
|
Requires-Dist: pydantic-settings>=2.11.0
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.14
|
|
10
10
|
Description-Content-Type: text/markdown
|
|
11
11
|
|
|
12
12
|
# turbo-lambda
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "turbo-lambda"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.8.0"
|
|
4
4
|
description = "Turbo Lambda Description"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
authors = [{ name = "Sam Mosleh", email = "sam.mosleh.d@gmail.com" }]
|
|
7
|
-
requires-python = ">=3.
|
|
7
|
+
requires-python = ">=3.14"
|
|
8
8
|
dependencies = [
|
|
9
9
|
"opentelemetry-api>=1.27.0",
|
|
10
10
|
"pydantic-settings>=2.11.0",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import annotationlib
|
|
1
2
|
import contextlib
|
|
2
3
|
import contextvars
|
|
3
4
|
import datetime
|
|
@@ -57,6 +58,10 @@ def _setup_logger() -> None: # pragma: no cover
|
|
|
57
58
|
lambda_runtime_log_utils._json_encoder.default = _json_custom_default
|
|
58
59
|
|
|
59
60
|
|
|
61
|
+
def _default_result_extractor[T](res: T) -> dict[str, T]:
|
|
62
|
+
return {"result": res}
|
|
63
|
+
|
|
64
|
+
|
|
60
65
|
@overload
|
|
61
66
|
def log_after_call[**P, T](func: Callable[P, T]) -> Callable[P, T]: ...
|
|
62
67
|
|
|
@@ -68,7 +73,7 @@ def log_after_call[**P, T](
|
|
|
68
73
|
log_message: str = "call",
|
|
69
74
|
log_exceptions: bool = False,
|
|
70
75
|
excluded_fields: Iterable[str] = ("self",),
|
|
71
|
-
result_extractor:
|
|
76
|
+
result_extractor: bool = False,
|
|
72
77
|
) -> Callable[[Callable[P, T]], Callable[P, T]]: ...
|
|
73
78
|
|
|
74
79
|
|
|
@@ -89,10 +94,17 @@ def log_after_call[**P, T]( # noqa: PLR0913
|
|
|
89
94
|
log_message: str = "call",
|
|
90
95
|
log_exceptions: bool = False,
|
|
91
96
|
excluded_fields: Iterable[str] = ("self",),
|
|
92
|
-
result_extractor: Callable[[T], dict[str, Any]] |
|
|
97
|
+
result_extractor: Callable[[T], dict[str, Any]] | bool = False,
|
|
93
98
|
) -> Callable[P, T] | Callable[[Callable[P, T]], Callable[P, T]]:
|
|
94
99
|
def decorator(func: Callable[P, T]) -> Callable[P, T]:
|
|
95
|
-
sig = inspect.signature(func)
|
|
100
|
+
sig = inspect.signature(func, annotation_format=annotationlib.Format.STRING)
|
|
101
|
+
result_extractor_func = (
|
|
102
|
+
result_extractor
|
|
103
|
+
if callable(result_extractor)
|
|
104
|
+
else _default_result_extractor
|
|
105
|
+
if result_extractor
|
|
106
|
+
else None
|
|
107
|
+
)
|
|
96
108
|
|
|
97
109
|
@wraps(func)
|
|
98
110
|
def wrapper(*f_args: P.args, **f_kwargs: P.kwargs) -> T:
|
|
@@ -110,8 +122,8 @@ def log_after_call[**P, T]( # noqa: PLR0913
|
|
|
110
122
|
st = time.monotonic()
|
|
111
123
|
try:
|
|
112
124
|
result = func(*f_args, **f_kwargs)
|
|
113
|
-
if
|
|
114
|
-
extra.update(
|
|
125
|
+
if result_extractor_func:
|
|
126
|
+
extra.update(result_extractor_func(result))
|
|
115
127
|
return result
|
|
116
128
|
except Exception as e:
|
|
117
129
|
if log_exceptions:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{turbo_lambda-0.7.1 → turbo_lambda-0.8.0}/src/turbo_lambda/scripts/update_turbo_lambda_layer.py
RENAMED
|
File without changes
|
|
File without changes
|