You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Static typing: event_source makes handler untyped under mypy --strict #8331
Re-opening of #3568 with new approach for solving this.
#### Diagnosis
event_source defines return types as Any, rather than using a type variable, plus lambda_handler_decorator's return type is simply Callable (equivalent to Callable[..., Any]) that mypy gets for the usage of the wrapper.
It's quite hard annotating lambda_handler_decorator accurately for all uses cases of it, but the specific one in event_source.py is simpler.
Proposed solution
Define the resultant type of lambda_handler_decorator(_event_source) as decorated, since this has data_class as keyword only I think this is only possible with a Protocol. We then cannot annotate the wrapped function directly so just cast afterwards.
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
Activity
boring-cyborg commentedon Jul 11, 2026
Thanks for opening your first issue here! We'll come back to you as soon as we can.
In the meantime, check out the #python channel on our Powertools for AWS Lambda Discord: Invite link
leandrodamascena commentedon Jul 12, 2026
Hey @stenczelt thanks a lot for opening this. I just saw the PR and looks good to merge.
powertools-for-aws-oss-automation commentedon Jul 12, 2026
Warning
This issue is now closed. Please be mindful that future comments are hard for our team to see.
If you need more assistance, please either reopen the issue, or open a new issue referencing this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.
github-actions commentedon Jul 13, 2026
This is now released under 3.31.1 version!