-
Notifications
You must be signed in to change notification settings - Fork 429
mypy fails with @tracer.capture_lambda_handler #360
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 a lot for raising it @joyofhex, and it's quite timely because we're working to make MyPy compliant for the next release ;-) Let us know if you find anything else and we keep you posted! |
@joyofhex @heitorlessa i have a fix in for this on #365 So this example will work via MyPy from aws_lambda_powertools import Tracer
tracer = Tracer()
@tracer.capture_lambda_handler
def handler(event, context):
return None |
Oh, excellent. Thanks for taking the time to address this. |
Reopening as we will include this in the next minor release, then we can ping you once it's available :) |
@heitorlessa I think we need to something else to mark the modules as PEP 561 |
Using mypy to typecheck code decorated with the @tracer.capture_lambda_handler fails since v1.10.
Expected Behavior
Mypy should not fail with code decorated with the capture_lambda_handler.
Current Behavior
Possible Solution
First of all, thanks for the incredibly useful library. It has been a pleasure to work with it.
It seems that in commit 11ebcf9 the following change was introduced:
This seems to have changed the expected handler signature to have three parameters instead of two, which is causing the sample code to fail. I've worked around this for now by adding a
_ignored: Optional[Any] = None
parameter to my lambda handler.Steps to Reproduce (for bugs)
I created a small repo repo (uh) here: https://github.com/joyofhex/repocase-for-powertools
Environment
The text was updated successfully, but these errors were encountered: