-
Notifications
You must be signed in to change notification settings - Fork 421
Missing return type in lambda_handler_decorator leads to 'Untyped decorator makes function "..." untyped' errors in mypy strict mode #1060
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
hey @huonw thanks for yet another high quality bug report! We should definitely go for option 1. This utility predates our experience with Mypy. It's also due for a refresh on docs, and making a generic decorator factory for any sync Python function. The reason we didn't choose Are you able to run without strict until we get other high priority fixes in place? I'd estimate looking into this next week. Thanks again! |
Ah, that's fair enough. I've done two attempts in #1066: first commit is a more complex version that I couldn't get to work, while the second undoes most of it to make a small improvement. As a middle-ground between the current state and |
hey @huonw I haven't forgotten this - fixing some important bugs on Logger and Logger utils, and will start reviewing this. I'd like to run a full scan using |
This is now released under 1.25.7 version! |
What were you trying to accomplish?
I'm trying to use
aws_lambda_powertools.utilities.data_classes.event_source
withmypy --strict
, and receive errors aboutUntyped decorator makes function "handler" untyped
. This is becauselambda_handler_decorator
is missing a return value, so mypy doesn't know anything about any function decorated with it (includingevent_source
):https://github.com/awslabs/aws-lambda-powertools-python/blob/22f8b9a7f47a2a4682c6f3f03536ac848ae7dc0d/aws_lambda_powertools/middleware_factory/factory.py#L15
Expected Behavior
@event_source
and other decorators using@lambda_handler_decorator
should work in mypy strict mode.Current Behavior
Mypy emits errors.
Possible Solution
Callable[something, here]
return value tolambda_handler_decorator
mypy --strict
in this package's CISteps to Reproduce (for bugs)
requirements:
input.py
:invocation:
Environment
The text was updated successfully, but these errors were encountered: