-
Notifications
You must be signed in to change notification settings - Fork 401
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
Bug: Pydantic is being imported when using Event Handler without validation #3370
Comments
leandrodamascena
added
bug
Something isn't working
triage
Pending triage from maintainers
labels
Nov 20, 2023
github-project-automation
bot
moved this to Triage
in Powertools for AWS Lambda (Python)
Nov 20, 2023
Working at this now |
rubenfonseca
moved this from Backlog
to Working on it
in Powertools for AWS Lambda (Python)
Nov 22, 2023
7 tasks
7 tasks
github-project-automation
bot
moved this from Working on it
to Coming soon
in Powertools for AWS Lambda (Python)
Nov 22, 2023
|
github-actions
bot
added
the
pending-release
Fix or implementation already in dev waiting to be released
label
Nov 22, 2023
This is now released under 2.28.0 version! |
github-actions
bot
removed
the
pending-release
Fix or implementation already in dev waiting to be released
label
Nov 23, 2023
heitorlessa
moved this from Coming soon
to Shipped
in Powertools for AWS Lambda (Python)
Dec 6, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Expected Behaviour
I'm using
ApiGatewayResolver
without enabling validation and it shouldn't import Pydantic. Even if a customer has Pydantic installed, they should not import Pydantic without explicitly enabling validation:app = ApiGatewayResolver(enable_validation=True)
Current Behaviour
Profiling the application with tuna, I can see Pydantic being imported:
Code snippet
Possible Solution
Move these imports to an standalone file or import them only when enable_validation is True.
Steps to Reproduce
1 - Create a file
2 - pip install aws-lambda-powertools[all] tuna
3 - Use the code snippet provided
4 - python -X importtime test.py 2> prof1.log
5 - tuna prof1.log
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: