Description
Key information
- RFC PR: feat: Static Types for AWS Lambda #149 (leave this empty)
- Related issue(s), if known:
- Area: Utilities
- Meet tenets: Yes
Summary
When you are developing an AWS Lambda function the handler has 2 arguments an event and a context, the context argument has a fixed structure and methods adding typing would empower the developer because your IDE is now able to give hints on what properties and methods are available.
Motivation
When I developing AWS Lambda function is tent to do this:
from typing import Any, Dict
from aws_lambda_context import LambdaContext
def handler(event: Dict[str, Any], context: LambdaContext):
pass
This has a downside of having to include the aws_lambda_context
package for just typing if you need to do that for every single thing your dependency list will grow out of proportion eventually. Besides that the AWS Lambda Powertools exist to make Lambda development easier having hints in your IDE is just that.
Proposal
My proposal is to fork the gist @heitorlessa supplied in a discussion (can be found here) into this repository.
I was thinking of creating a utilities/typing
module where these static type classes would live.
For now, the only logical type is the LambdaContext
(and subtypes) type for the event does not have any value as the content varies too much.
Drawbacks
None, if you know one please feel free to leave a comment
Rationale and alternatives
- What other designs have been considered? Why not them? Including the typing every time will not help developers that don't know that they exist
- What is the impact of not doing this? Developers
Unresolved questions
None, if you know one please feel free to leave a comment
Metadata
Metadata
Assignees
Type
Projects
Status