Skip to main content

A package that provides type hints for AWS Lambda event, context and response objects

Project description

AWS Lambda Typing

build test License python_version pypi_v pypi_dm

A package that provides type hints for AWS Lambda event, context and response objects. It's a convenient way to get autocomplete and type hints built into IDEs. Type annotations are not checked at runtime but are only enforced by third party tools such as type checkers, IDEs, linters, etc.

Table of Contents

Usage

Example: AWS SQS event

from aws_lambda_typing import context as context_, events


def handler(event: events.SQSEvent, context: context_.Context) -> None:
    for record in event['Records']:
        print(record['body'])

    print(context.get_remaining_time_in_millis())

    message: events.sqs.SQSMessage

Demo

IDE autocomplete

ide_autocomplete

IDE code reference information

code_reference_information

Types

Context

  • Context

Events

  • ALBEvent
  • APIGatewayRequestAuthorizerEvent
  • APIGatewayTokenAuthorizerEvent
  • APIGatewayProxyEventV1
  • APIGatewayProxyEventV2
  • AppSyncResolverEvent
  • CloudFormationCustomResourceEvent
  • CloudWatchEventsMessageEvent
  • CloudWatchLogsEvent
  • CodeCommitMessageEvent
  • CodePipelineEvent
  • ConfigEvent
  • DynamoDBStreamEvent
  • IoTPreProvisioningHookEvent
  • KinesisFirehoseEvent
  • KinesisStreamEvent
  • MQEvent
  • MSKEvent
  • S3Event
  • S3BatchEvent
  • SecretsManagerRotationEvent
  • SESEvent
  • SNSEvent
  • SQSEvent

Responses

  • ALBResponse
  • APIGatewayAuthorizerResponse
  • APIGatewayProxyResponseV1
  • APIGatewayProxyResponseV2
  • IoTPreProvisioningHookResponse
  • S3BatchResponse

Other

  • PolicyDocument

Develop

Activate virtual environment

poetry shell

Install dependencies

poetry install --remove-untracked

Install git hooks

pre-commit install --hook-type pre-commit

Run tests

mypy tests

Run linter

flake8 .

Format code

black .

Sort imports

isort .

Contributing

Contributions are welcome via pull requests.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-lambda-typing-2.9.0.tar.gz (15.8 kB view hashes)

Uploaded Source

Built Distribution

aws_lambda_typing-2.9.0-py3-none-any.whl (27.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page