-
Notifications
You must be signed in to change notification settings - Fork 429
Bug: pydantic imports from aws_lambda_powertools.utilities.parser.pydantic no longer available #5249
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 @RyanFrench, thanks for opening this issue to report this behavior. 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 your suggestion that we need to improve our documentation and upgrade guide to make it clear to customers, but I don't think we should revert this change for a few reasons: 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 v2 is slower than v1 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. I will be sending a PR today to update our Upgrade Guide and documentation to clarify this change. I will ping you on this PR to get your feedback - if possible. Thank you very much for bringing this up, I believe that improving our documentation will prevent other customers from having the same issue. |
Thank you, I assumed as much but wasn't sure what the new recommended way was to use other pydantic classes within the parser. |
|
This is now released under 3.1.0 version! |
Expected Behaviour
As per the documentation FAQ I would expect to be able to import X from pydantic to include types such as EmailStr
Current Behaviour
Currently in 3.0.0 we are unable to import pydantic types via the parser.
Code snippet
Possible Solution
Update documentation to include the recommended way to import X from pydantic, or implement the feature that was available in 2.X.
Steps to Reproduce
Try and import a pydantic type from aws_lambda_powertools.utilities.parser.pydantic, which no longer exists.
Powertools for AWS Lambda (Python) version
latest
AWS Lambda function runtime
3.11
Packaging format used
PyPi
Debugging logs
No response
The text was updated successfully, but these errors were encountered: