-
Notifications
You must be signed in to change notification settings - Fork 421
Bug: aws_lambda_powertools.utilities.parser.pydantic does not exist anymore while mentioned in the documentation #5390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
Hey @VladimirSvoboda! thanks a lot for opening this issue! In fact we are not exporting Pydantic objects from parser and we explain that in our upgrade guide to v3. In Powertools v3 we have dropped support for Pydantic v1 and are only supporting Pydantic v2 which is why we are no longer exporting pydantic types directly and allowing customers to import them directly from Pydantic. First, I must say that I agree with that we need to update our documentation and we are #5262. I'll try to merge this PR as soon as possible to prevent this type of error. Let me explain some reasons why we removed this export: 1 - Pydantic V2 was a complete refactoring of the Pydantic project and they made several changes including, but not limited, to the way they export types, classes, methods, and others. If we continue to expose them directly from Powertools and some export in Pydantic has changed, our customers may get the impression that there is some bug in Powertools and that is not the experience we want to have for our customers. 2 - The way we were doing this was by exposing everything exposed from pydantic to our customers, but there is a long discussion in the Pydantic repository about how pydantic/pydantic#6748 when importing and loading things in this new version. We don't want our customers to inadvertently import everything from Pydantic and this could create some slowdown in their functions. We are working to improve this documentation in this PR - #5262 Can you please try importing them directly from Pydantic? Thanks |
Thanks for your answer. I now import directly from pydantic to fix the issue. |
Hi @VladimirSvoboda ! Thank you for your follow-up and for bringing this to our attention. You're absolutely right that the documentation issue hasn't been fully addressed by #526 yet. We appreciate your patience and the workaround you've implemented using direct imports from pydantic. We're actively working on a comprehensive update to the Parser documentation, which will include fixing the import errors you've mentioned. We expect to release these changes within the next few weeks. In the meantime, if you encounter any other issues, please don't hesitate to let us know. |
Hey @VladimirSvoboda! We are closing this issue because we merged the PR! We are releasing next week with this fix. |
|
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
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
aws_lambda_powertools/utilities/parser/pydantic.py
removed in feat(parser): Allow primitive data types to be parsed using TypeAdapter #4502Steps to Reproduce
Execute the following code snippet
Powertools for AWS Lambda (Python) version
3.1.0
AWS Lambda function runtime
3.12
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: