Type Annotations for aiobotocore Lambda

3.4.0 · active · verified Sat Apr 11

types-aiobotocore-lambda provides machine-generated type annotations (stubs) for the aiobotocore Lambda service, enabling static type checking and improved IDE autocompletion for asynchronous AWS SDK usage in Python. It is part of the mypy-boto3-builder project, currently at version 3.4.0, with regular updates following upstream aiobotocore and botocore releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to set up an aiobotocore Lambda client with explicit type annotations using `types-aiobotocore-lambda` to leverage static analysis and IDE autocompletion for asynchronous AWS Lambda operations. It lists available Lambda functions.

import asyncio
from aiobotocore.session import get_session
from types_aiobotocore_lambda.client import LambdaClient

async def list_lambda_functions():
    session = get_session()
    # Ensure AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are set in environment
    # or ~/.aws/credentials for this to run.
    async with session.create_client("lambda") as client:
        client: LambdaClient # Explicit type hint for static analysis
        response = await client.list_functions()
        for func in response.get("Functions", []):
            print(f"Function Name: {func['FunctionName']}, Runtime: {func['Runtime']}")

if __name__ == "__main__":
    asyncio.run(list_lambda_functions())

view raw JSON →