aws / aws-lambda-python-runtime-interface-client

Apache License 2.0
263 stars 76 forks source link

Typing annotations #18

Open ediskandarov opened 3 years ago

ediskandarov commented 3 years ago

I've created typing annotations for LambdaContext and corresponding classes.

https://github.com/toidi/awslambdaric-stubs

It's useful in lambda handlers:

import typing
if typing.TYPE_CHECKING:  # pragma: no cover
    from awslambdaric.lambda_context import LambdaContext

def lambda_handler(event: dict, context: "LambdaContext") -> typing.Any:
    print(context.memory_limit_in_mb)
    ...

Perhaps, it would be better to move typing definition in this repository?