From c711d9a175ba535fa4c1fa3a859cdb9d8db06943 Mon Sep 17 00:00:00 2001 From: Leandro Damascena <lcdama@amazon.pt> Date: Sat, 5 Oct 2024 23:33:34 +0100 Subject: [PATCH 1/2] Updating uograde guide --- docs/upgrade.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/upgrade.md b/docs/upgrade.md index 9d29be758e6..59732bfb3c1 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -17,6 +17,7 @@ We've made minimal breaking changes to make your transition to v3 as smooth as p | ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | -------------------- | | **Pydantic** | We have removed support for [Pydantic v1](#drop-support-for-pydantic-v1) | No | | **Parser** | We have replaced [DynamoDBStreamModel](#dynamodbstreammodel-in-parser) `AttributeValue` with native Python types | Yes | +| **Parser** | We no longer export [Pydantic objects](#importing-pydantic-objects) from `parser.pydantic`. | Yes | | **Lambda layer** | [Lambda layers](#new-aws-lambda-layer-arns) are now compiled according to the specific Python version and architecture | No | | **Event Handler** | We [have deprecated](#event-handler-headers-are-case-insensitive) the `get_header_value` function. | Yes | | **Batch Processor** | `@batch_processor` and `@async_batch_processor` decorators [are now deprecated](#deprecated-batch-processing-decorators) | Yes | @@ -91,6 +92,20 @@ def lambda_handler(event: DynamoDBStreamModel, context: LambdaContext): ``` +## Importing Pydantic objects + +We have stopped exporting Pydantic objects directly from `aws_lambda_powertools.utilities.parser.pydantic` to prevent potential confusion caused by Pydantic V2's significant changes in type, class, and method exports. + +This change prevents customers from accidentally importing all of Pydantic, which could significantly slow down function startup times. + +```diff +- #BEFORE - v2 +- from aws_lambda_powertools.utilities.parser.pydantic import EmailStr + ++ # NOW - v3 ++ from pydantic import EmailStr +``` + ## New AWS Lambda Layer ARNs !!! note "No code changes required" From 3968cf060285786587895be6736dd8936454d1b0 Mon Sep 17 00:00:00 2001 From: Leandro Damascena <lcdama@amazon.pt> Date: Mon, 7 Oct 2024 10:39:04 +0100 Subject: [PATCH 2/2] Addressing Andrea's feedback --- docs/upgrade.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/upgrade.md b/docs/upgrade.md index 59732bfb3c1..c5c4f1da122 100644 --- a/docs/upgrade.md +++ b/docs/upgrade.md @@ -94,9 +94,7 @@ def lambda_handler(event: DynamoDBStreamModel, context: LambdaContext): ## Importing Pydantic objects -We have stopped exporting Pydantic objects directly from `aws_lambda_powertools.utilities.parser.pydantic` to prevent potential confusion caused by Pydantic V2's significant changes in type, class, and method exports. - -This change prevents customers from accidentally importing all of Pydantic, which could significantly slow down function startup times. +We have stopped exporting Pydantic objects directly from `aws_lambda_powertools.utilities.parser.pydantic`. This change prevents customers from accidentally importing all of Pydantic, which could significantly slow down function startup times. ```diff - #BEFORE - v2