Skip to content

Commit ee86a06

Browse files
Merge branch 'develop' into custom_mask
2 parents 9272ac0 + 1c36e13 commit ee86a06

File tree

96 files changed

+838
-186
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+838
-186
lines changed

.github/workflows/quality_check.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ jobs:
6161
python-version: ${{ matrix.python-version }}
6262
- name: Install dependencies
6363
run: make dev-quality-code
64+
- name: Checking third-party library licenses
65+
run: make check-licenses
6466
- name: Formatting and Linting
6567
run: make lint
6668
- name: Static type checking

.github/workflows/reusable_publish_docs.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,6 @@ jobs:
8484
aws-region: us-east-1
8585
role-to-assume: ${{ secrets.AWS_DOCS_ROLE_ARN }}
8686
mask-aws-account-id: true
87-
- name: Copy API Docs
88-
run: |
89-
cp -r api site/
9087
- name: Deploy Docs (Version)
9188
env:
9289
VERSION: ${{ inputs.version }}

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,4 +314,7 @@ examples/**/sam/.aws-sam
314314

315315
cdk.out
316316
# NOTE: different accounts will be used for E2E thus creating unnecessary git clutter
317-
cdk.context.json
317+
cdk.context.json
318+
319+
# vim
320+
*.swp

CHANGELOG.md

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,60 @@
99
* **docs:** typo in a service name in Event Handler ([#5944](https://github.com/aws-powertools/powertools-lambda-python/issues/5944))
1010
* **logger:** child logger must respect log level ([#5950](https://github.com/aws-powertools/powertools-lambda-python/issues/5950))
1111

12+
## Code Refactoring
13+
14+
* **metrics:** Improve type annotations for metrics decorator ([#6000](https://github.com/aws-powertools/powertools-lambda-python/issues/6000))
15+
1216
## Documentation
1317

18+
* **api:** migrating the tracer utility to mkdocstrings ([#6017](https://github.com/aws-powertools/powertools-lambda-python/issues/6017))
19+
* **api:** migrating the batch utility to mkdocstrings ([#6016](https://github.com/aws-powertools/powertools-lambda-python/issues/6016))
20+
* **api:** migrating the event source data classes utility to mkdocstrings ([#6015](https://github.com/aws-powertools/powertools-lambda-python/issues/6015))
21+
* **api:** migrating the data masking utility to mkdocstrings ([#6013](https://github.com/aws-powertools/powertools-lambda-python/issues/6013))
22+
* **api:** migrating the AppConfig utility to mkdocstrings ([#6008](https://github.com/aws-powertools/powertools-lambda-python/issues/6008))
23+
* **api:** migrating the idempotency utility to mkdocstrings ([#6007](https://github.com/aws-powertools/powertools-lambda-python/issues/6007))
24+
* **api:** migrating the jmespath utility to mkdocstrings ([#6006](https://github.com/aws-powertools/powertools-lambda-python/issues/6006))
25+
* **api:** migrating the parameters utility to mkdocstrings ([#6005](https://github.com/aws-powertools/powertools-lambda-python/issues/6005))
26+
* **api:** migrating the parser utility to mkdocstrings ([#6004](https://github.com/aws-powertools/powertools-lambda-python/issues/6004))
27+
* **api:** migrating the streaming utility to mkdocstrings ([#6003](https://github.com/aws-powertools/powertools-lambda-python/issues/6003))
28+
* **api:** migrating the typing utility to mkdocstrings ([#5996](https://github.com/aws-powertools/powertools-lambda-python/issues/5996))
1429
* **api:** migrating the validation utility to mkdocstrings ([#5972](https://github.com/aws-powertools/powertools-lambda-python/issues/5972))
1530
* **layer:** update layer version number - v3.5.0 ([#5952](https://github.com/aws-powertools/powertools-lambda-python/issues/5952))
1631

1732
## Features
1833

1934
* **logger:** add clear_state method ([#5956](https://github.com/aws-powertools/powertools-lambda-python/issues/5956))
35+
* **openapi:** enhance support for tuple return type validation ([#5997](https://github.com/aws-powertools/powertools-lambda-python/issues/5997))
2036

2137
## Maintenance
2238

39+
* **ci:** new pre-release 3.5.1a4 ([#6018](https://github.com/aws-powertools/powertools-lambda-python/issues/6018))
2340
* **ci:** new pre-release 3.5.1a0 ([#5945](https://github.com/aws-powertools/powertools-lambda-python/issues/5945))
2441
* **ci:** new pre-release 3.5.1a1 ([#5954](https://github.com/aws-powertools/powertools-lambda-python/issues/5954))
2542
* **ci:** install & configure mkdocstrings plugin ([#5959](https://github.com/aws-powertools/powertools-lambda-python/issues/5959))
43+
* **ci:** new pre-release 3.5.1a3 ([#5998](https://github.com/aws-powertools/powertools-lambda-python/issues/5998))
2644
* **ci:** new pre-release 3.5.1a2 ([#5970](https://github.com/aws-powertools/powertools-lambda-python/issues/5970))
27-
* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.18 to 3.0.20 ([#5977](https://github.com/aws-powertools/powertools-lambda-python/issues/5977))
28-
* **deps:** bump squidfunk/mkdocs-material from `41942f7` to `471695f` in /docs ([#5979](https://github.com/aws-powertools/powertools-lambda-python/issues/5979))
29-
* **deps:** bump actions/setup-go from 5.2.0 to 5.3.0 ([#5978](https://github.com/aws-powertools/powertools-lambda-python/issues/5978))
30-
* **deps:** bump aws-actions/configure-aws-credentials from 4.0.2 to 4.0.3 ([#5975](https://github.com/aws-powertools/powertools-lambda-python/issues/5975))
31-
* **deps:** bump actions/upload-artifact from 4.5.0 to 4.6.0 ([#5962](https://github.com/aws-powertools/powertools-lambda-python/issues/5962))
32-
* **deps:** bump actions/setup-node from 4.1.0 to 4.2.0 ([#5963](https://github.com/aws-powertools/powertools-lambda-python/issues/5963))
33-
* **deps:** bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4 ([#5980](https://github.com/aws-powertools/powertools-lambda-python/issues/5980))
3445
* **deps:** bump codecov/codecov-action from 5.1.2 to 5.3.1 ([#5964](https://github.com/aws-powertools/powertools-lambda-python/issues/5964))
35-
* **deps:** bump docker/setup-qemu-action from 3.2.0 to 3.3.0 ([#5961](https://github.com/aws-powertools/powertools-lambda-python/issues/5961))
3646
* **deps:** bump release-drafter/release-drafter from 6.0.0 to 6.1.0 ([#5976](https://github.com/aws-powertools/powertools-lambda-python/issues/5976))
47+
* **deps:** bump aws-actions/configure-aws-credentials from 4.0.2 to 4.0.3 ([#5975](https://github.com/aws-powertools/powertools-lambda-python/issues/5975))
3748
* **deps:** bump actions/setup-python from 5.3.0 to 5.4.0 ([#5960](https://github.com/aws-powertools/powertools-lambda-python/issues/5960))
38-
* **deps-dev:** bump ruff from 0.9.3 to 0.9.4 ([#5969](https://github.com/aws-powertools/powertools-lambda-python/issues/5969))
49+
* **deps:** bump pypa/gh-action-pypi-publish from 1.12.3 to 1.12.4 ([#5980](https://github.com/aws-powertools/powertools-lambda-python/issues/5980))
50+
* **deps:** bump actions/setup-go from 5.2.0 to 5.3.0 ([#5978](https://github.com/aws-powertools/powertools-lambda-python/issues/5978))
51+
* **deps:** bump squidfunk/mkdocs-material from `471695f` to `7e841df` in /docs ([#6012](https://github.com/aws-powertools/powertools-lambda-python/issues/6012))
52+
* **deps:** bump squidfunk/mkdocs-material from `41942f7` to `471695f` in /docs ([#5979](https://github.com/aws-powertools/powertools-lambda-python/issues/5979))
53+
* **deps:** bump docker/setup-qemu-action from 3.2.0 to 3.3.0 ([#5961](https://github.com/aws-powertools/powertools-lambda-python/issues/5961))
54+
* **deps:** bump actions/upload-artifact from 4.5.0 to 4.6.0 ([#5962](https://github.com/aws-powertools/powertools-lambda-python/issues/5962))
55+
* **deps:** bump actions/setup-node from 4.1.0 to 4.2.0 ([#5963](https://github.com/aws-powertools/powertools-lambda-python/issues/5963))
56+
* **deps:** bump zgosalvez/github-actions-ensure-sha-pinned-actions from 3.0.18 to 3.0.20 ([#5977](https://github.com/aws-powertools/powertools-lambda-python/issues/5977))
3957
* **deps-dev:** bump mkdocs-material from 9.5.50 to 9.6.1 ([#5966](https://github.com/aws-powertools/powertools-lambda-python/issues/5966))
40-
* **deps-dev:** bump black from 24.10.0 to 25.1.0 ([#5968](https://github.com/aws-powertools/powertools-lambda-python/issues/5968))
41-
* **deps-dev:** bump cfn-lint from 1.22.7 to 1.23.1 ([#5967](https://github.com/aws-powertools/powertools-lambda-python/issues/5967))
4258
* **deps-dev:** bump isort from 5.13.2 to 6.0.0 ([#5965](https://github.com/aws-powertools/powertools-lambda-python/issues/5965))
59+
* **deps-dev:** bump cfn-lint from 1.22.7 to 1.23.1 ([#5967](https://github.com/aws-powertools/powertools-lambda-python/issues/5967))
60+
* **deps-dev:** bump black from 24.10.0 to 25.1.0 ([#5968](https://github.com/aws-powertools/powertools-lambda-python/issues/5968))
61+
* **deps-dev:** bump mkdocstrings-python from 1.13.0 to 1.14.2 ([#6011](https://github.com/aws-powertools/powertools-lambda-python/issues/6011))
62+
* **deps-dev:** bump mkdocs-material from 9.6.1 to 9.6.2 ([#6009](https://github.com/aws-powertools/powertools-lambda-python/issues/6009))
63+
* **deps-dev:** bump boto3-stubs from 1.36.10 to 1.36.11 ([#6010](https://github.com/aws-powertools/powertools-lambda-python/issues/6010))
64+
* **deps-dev:** bump boto3-stubs from 1.36.10 to 1.36.12 ([#6014](https://github.com/aws-powertools/powertools-lambda-python/issues/6014))
65+
* **deps-dev:** bump ruff from 0.9.3 to 0.9.4 ([#5969](https://github.com/aws-powertools/powertools-lambda-python/issues/5969))
4366

4467

4568
<a name="v3.5.0"></a>

Makefile

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
.PHONY: target dev format lint test coverage-html pr build build-docs build-docs-api build-docs-website
2-
.PHONY: docs-local docs-api-local security-baseline complexity-baseline release-prod release-test release
1+
.PHONY: target dev format lint test coverage-html pr build build-docs build-docs-website check-licenses
2+
.PHONY: docs-local security-baseline complexity-baseline release-prod release-test release
33

44
target:
55
@$(MAKE) pr
@@ -21,6 +21,10 @@ dev-gitpod:
2121
poetry install --extras "all redis datamasking"
2222
pre-commit install
2323

24+
# Running licensecheck with zero to break the pipeline if there is an invalid license
25+
check-licenses:
26+
poetry run licensecheck -u poetry:dev --zero
27+
2428
format:
2529
poetry run black aws_lambda_powertools tests examples
2630

@@ -55,7 +59,7 @@ coverage-html:
5559
pre-commit:
5660
pre-commit run --show-diff-on-failure
5761

58-
pr: lint lint-docs mypy pre-commit test security-baseline complexity-baseline
62+
pr: lint lint-docs mypy pre-commit check-licenses test security-baseline complexity-baseline
5963

6064
build: pr
6165
poetry build
@@ -65,14 +69,6 @@ release-docs:
6569
rm -rf site api
6670
@echo "Updating website docs"
6771
poetry run mike deploy --push --update-aliases ${VERSION} ${ALIAS}
68-
@echo "Building API docs"
69-
@$(MAKE) build-docs-api VERSION=${VERSION}
70-
71-
build-docs-api:
72-
poetry run pdoc --html --output-dir ./api/ ./aws_lambda_powertools --force
73-
mv -f ./api/aws_lambda_powertools/* ./api/
74-
rm -rf ./api/aws_lambda_powertools
75-
mkdir ${VERSION} && cp -R api ${VERSION}
7672

7773
docs-local:
7874
poetry run mkdocs serve
@@ -81,9 +77,6 @@ docs-local-docker:
8177
docker build -t squidfunk/mkdocs-material ./docs/
8278
docker run --rm -it -p 8000:8000 -v ${PWD}:/docs squidfunk/mkdocs-material
8379

84-
docs-api-local:
85-
poetry run pdoc --http : aws_lambda_powertools
86-
8780
security-baseline:
8881
poetry run bandit --baseline bandit.baseline -r aws_lambda_powertools
8982

aws_lambda_powertools/event_handler/api_gateway.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,10 @@ def __init__(
313313
middlewares: list[Callable[..., Response]] | None = None,
314314
):
315315
"""
316+
Internally used Route Configuration
316317
317318
Parameters
318319
----------
319-
320320
method: str
321321
The HTTP method, example "GET"
322322
path: str
@@ -908,6 +908,8 @@ def build(self, event: ResponseEventT, cors: CORSConfig | None = None) -> dict[s
908908

909909

910910
class BaseRouter(ABC):
911+
"""Base class for Routing"""
912+
911913
current_event: BaseProxyEvent
912914
lambda_context: LambdaContext
913915
context: dict
@@ -1459,7 +1461,7 @@ def _registered_api_adapter(app: ApiGatewayResolver, next_middleware: Callable[.
14591461

14601462

14611463
class ApiGatewayResolver(BaseRouter):
1462-
"""API Gateway and ALB proxy resolver
1464+
"""API Gateway, VPC Laticce, Bedrock and ALB proxy resolver
14631465
14641466
Examples
14651467
--------
@@ -2570,6 +2572,8 @@ def register_exception_handler(func: Callable):
25702572

25712573

25722574
class APIGatewayRestResolver(ApiGatewayResolver):
2575+
"""Amazon API Gateway REST and HTTP API v1 payload resolver"""
2576+
25732577
current_event: APIGatewayProxyEvent
25742578

25752579
def __init__(
@@ -2650,6 +2654,8 @@ def _compile_regex(rule: str, base_regex: str = _ROUTE_REGEX):
26502654

26512655

26522656
class APIGatewayHttpResolver(ApiGatewayResolver):
2657+
"""Amazon API Gateway HTTP API v2 payload resolver"""
2658+
26532659
current_event: APIGatewayProxyEventV2
26542660

26552661
def __init__(
@@ -2685,6 +2691,8 @@ def _get_base_path(self) -> str:
26852691

26862692

26872693
class ALBResolver(ApiGatewayResolver):
2694+
"""Amazon Application Load Balancer (ALB) resolver"""
2695+
26882696
current_event: ALBEvent
26892697

26902698
def __init__(

aws_lambda_powertools/event_handler/middlewares/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class BaseMiddlewareHandler(Generic[EventHandlerInstance], ABC):
2626
This is the middleware handler function where middleware logic is implemented.
2727
The next middleware handler is represented by `next_middleware`, returning a Response object.
2828
29-
Examples
29+
Example
3030
--------
3131
3232
**Correlation ID Middleware**

aws_lambda_powertools/event_handler/middlewares/openapi_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class OpenAPIValidationMiddleware(BaseMiddlewareHandler):
3737
Lambda handler. It also validates the response against the OpenAPI schema defined by the Lambda handler. It
3838
should not be used directly, but rather through the `enable_validation` parameter of the `ApiGatewayResolver`.
3939
40-
Examples
40+
Example
4141
--------
4242
4343
```python

aws_lambda_powertools/event_handler/middlewares/schema_validation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
class SchemaValidationMiddleware(BaseMiddlewareHandler):
1919
"""Middleware to validate API request and response against JSON Schema using the [Validation utility](https://docs.powertools.aws.dev/lambda/python/latest/utilities/validation/).
2020
21-
Examples
21+
Example
2222
--------
2323
**Validating incoming event**
2424

aws_lambda_powertools/event_handler/openapi/params.py

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,6 @@ def get_flat_dependant(
879879
----------
880880
dependant: Dependant
881881
The dependant model to flatten
882-
skip_repeats: bool
883-
If True, child Dependents already visited will be skipped to avoid duplicates
884882
visited: list[CacheKey], optional
885883
Keeps track of visited Dependents to avoid infinite recursion. Defaults to empty list.
886884
@@ -932,7 +930,12 @@ def analyze_param(
932930
ModelField | None
933931
The type annotation and the Pydantic field representing the parameter
934932
"""
935-
field_info, type_annotation = get_field_info_and_type_annotation(annotation, value, is_path_param)
933+
field_info, type_annotation = get_field_info_and_type_annotation(
934+
annotation,
935+
value,
936+
is_path_param,
937+
is_response_param,
938+
)
936939

937940
# If the value is a FieldInfo, we use it as the FieldInfo for the parameter
938941
if isinstance(value, FieldInfo):
@@ -962,7 +965,12 @@ def analyze_param(
962965
return field
963966

964967

965-
def get_field_info_and_type_annotation(annotation, value, is_path_param: bool) -> tuple[FieldInfo | None, Any]:
968+
def get_field_info_and_type_annotation(
969+
annotation,
970+
value,
971+
is_path_param: bool,
972+
is_response_param: bool,
973+
) -> tuple[FieldInfo | None, Any]:
966974
"""
967975
Get the FieldInfo and type annotation from an annotation and value.
968976
"""
@@ -976,19 +984,33 @@ def get_field_info_and_type_annotation(annotation, value, is_path_param: bool) -
976984
# If the annotation is a Response type, we recursively call this function with the inner type
977985
elif get_origin(annotation) is Response:
978986
field_info, type_annotation = get_field_info_response_type(annotation, value)
987+
# If the response param is a tuple with two elements, we use the first element as the type annotation,
988+
# just like we did in the APIGateway._to_response
989+
elif is_response_param and get_origin(annotation) is tuple and len(get_args(annotation)) == 2:
990+
field_info, type_annotation = get_field_info_tuple_type(annotation, value)
979991
# If the annotation is not an Annotated type, we use it as the type annotation
980992
else:
981993
type_annotation = annotation
982994

983995
return field_info, type_annotation
984996

985997

998+
def get_field_info_tuple_type(annotation, value) -> tuple[FieldInfo | None, Any]:
999+
(inner_type, _) = get_args(annotation)
1000+
1001+
# If the inner type is an Annotated type, we need to extract the type annotation and the FieldInfo
1002+
if get_origin(inner_type) is Annotated:
1003+
return get_field_info_annotated_type(inner_type, value, False)
1004+
1005+
return None, inner_type
1006+
1007+
9861008
def get_field_info_response_type(annotation, value) -> tuple[FieldInfo | None, Any]:
9871009
# Example: get_args(Response[inner_type]) == (inner_type,) # noqa: ERA001
9881010
(inner_type,) = get_args(annotation)
9891011

9901012
# Recursively resolve the inner type
991-
return get_field_info_and_type_annotation(inner_type, value, False)
1013+
return get_field_info_and_type_annotation(inner_type, value, False, True)
9921014

9931015

9941016
def get_field_info_annotated_type(annotation, value, is_path_param: bool) -> tuple[FieldInfo | None, Any]:

aws_lambda_powertools/event_handler/openapi/swagger_ui/html.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def generate_swagger_html(
2222
spec: str
2323
The OpenAPI spec
2424
swagger_js: str
25-
Swagger UI JavaScript source code or URL
25+
Swagger UI JavaScript source code or URL
2626
swagger_css: str
2727
Swagger UI CSS source code or URL
2828
swagger_base_url: str

aws_lambda_powertools/logging/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Logging utility
2-
"""
1+
"""Logging utility"""
32

43
from .logger import Logger
54

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
class InvalidLoggerSamplingRateError(Exception):
2+
"""
3+
Logger configured with Invalid Sampling value
4+
"""
5+
26
pass

aws_lambda_powertools/logging/formatter.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,17 +273,17 @@ def append_context_keys(self, **additional_keys: Any) -> Generator[None, None, N
273273
"""
274274
Context manager to temporarily add logging keys.
275275
276-
Parameters:
276+
Parameters
277277
-----------
278-
**keys: Any
278+
**additional_keys: Any
279279
Key-value pairs to include in the log context during the lifespan of the context manager.
280280
281-
Example:
281+
Example
282282
--------
283-
>>> logger = Logger(service="example_service")
284-
>>> with logger.append_context_keys(user_id="123", operation="process"):
285-
>>> logger.info("Log with context")
286-
>>> logger.info("Log without context")
283+
logger = Logger(service="example_service")
284+
with logger.append_context_keys(user_id="123", operation="process"):
285+
logger.info("Log with context")
286+
logger.info("Log without context")
287287
"""
288288
# Add keys to the context
289289
self.append_keys(**additional_keys)

0 commit comments

Comments
 (0)