aws-powertools / powertools-lambda-python

A developer toolkit to implement Serverless best practices and increase developer velocity.
https://docs.powertools.aws.dev/lambda/python/latest/
MIT No Attribution
2.84k stars 391 forks source link

Bug: aws_lambda_powertools.utilities.parser.pydantic does not exist anymore while mentioned in the documentation #5390

Open VladimirSvoboda opened 4 hours ago

VladimirSvoboda commented 4 hours ago

Expected Behaviour

Contrarily to what is stated in the documentation, since the version 3 (and more precisely the pull request #4502) , it is not possible anymore to import any Pydantic module/function through aws_lambda_powertools.utilities.parser.pydantic.

In my case, I would like to be able to import the decorator @field_serializer

Current Behaviour

python -c "from aws_lambda_powertools.utilities.parser.pydantic import field_serializer"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'aws_lambda_powertools.utilities.parser.pydantic'

Code snippet

python3 -m venv venv source venv/bin/activate pip install aws-lambda-powertools[all]==3.1.0 python -c "from aws_lambda_powertools.utilities.parser.pydantic import field_serializer"

Possible Solution

  1. Restore the file aws_lambda_powertools/utilities/parser/pydantic.py removed in #4502
  2. Correct the documentation

Steps to Reproduce

Execute the following code snippet

python3 -m venv venv
source venv/bin/activate
pip install aws-lambda-powertools[all]==3.1.0
python -c "from aws_lambda_powertools.utilities.parser.pydantic import field_serializer"

Powertools for AWS Lambda (Python) version

3.1.0

AWS Lambda function runtime

3.12

Packaging format used

PyPi

Debugging logs

No response

boring-cyborg[bot] commented 4 hours ago

Thanks for opening your first issue here! We'll come back to you as soon as we can. In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link