Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 69.1MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.5s · import 0.000s · 140MB
104MB installed
● package 104MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LambdaClient
✓ from boto3_stubs.lambda.client import LambdaClient
✗ from boto3-stubs.lambda.client import LambdaClient
This quickstart demonstrates how to obtain a type-hinted AWS Lambda client and invoke a function. It includes the necessary `TYPE_CHECKING` guard to ensure the type stubs are only used during static analysis, avoiding a runtime dependency. The function name is retrieved from an environment variable for reusability.
import boto3
import os
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_lambda.client import LambdaClient
from mypy_boto3_lambda.type_defs import InvokeFunctionResponseTypeDef
def get_lambda_client() -> "LambdaClient":
"""Returns a typed Lambda client."""
return boto3.client("lambda")
def invoke_my_lambda(client: "LambdaClient", function_name: str, payload: dict) -> "InvokeFunctionResponseTypeDef":
"""Invokes a Lambda function with type hints."""
response = client.invoke(
FunctionName=function_name,
InvocationType='RequestResponse',
Payload=bytes(str(payload).encode('utf-8'))
)
return response
# Example Usage
if __name__ == "__main__":
lambda_client = get_lambda_client()
# Use os.environ.get for dynamic configuration in runnable examples
function_name = os.environ.get('LAMBDA_FUNCTION_NAME', 'my-test-lambda-function')
example_payload = {"greeting": "hello from types-boto3-lambda"}
try:
print(f"Invoking Lambda function: {function_name}")
response = invoke_my_lambda(lambda_client, function_name, example_payload)
print(f"Lambda Invocation Status Code: {response.get('StatusCode')}")
# If the Lambda returns a JSON payload, you might want to read and decode it
# payload_stream = response.get('Payload')
# if payload_stream:
# payload_data = payload_stream.read().decode('utf-8')
# print(f"Lambda Response Payload: {payload_data}")
except Exception as e:
print(f"Error invoking Lambda: {e}")
Debug
Known issues
breakingSupport for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0 and consequently for all generated `types-boto3` packages, including `types-boto3-lambda`.fixUpgrade your Python environment to 3.9 or newer.
affects: >=8.12.0 (builder), >=1.42.85 (types-boto3-lambda)
breakingTypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0. TypeDefs for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`).fixReview and update your TypeDef import paths and names to match the new, shorter conventions.
affects: >=8.9.0 (builder), likely versions >=1.35.x (types-boto3-lambda) due to synchronization with boto3
gotchaWhen using `boto3-stubs-lite[lambda]` or `mypy-boto3-lambda` (standalone package), explicit type annotations are often required for `boto3.client` calls to enable full type inference. Without them, IDEs and type checkers might not provide complete suggestions or checks.fixAlways explicitly type annotate your client instances: `client: LambdaClient = boto3.client('lambda')`. affects: All versions when using lite or standalone packages
gotchaPyCharm can experience performance issues with `Literal` overloads in `types-boto3` packages, leading to high CPU usage.fixConsider using `boto3-stubs-lite` packages (e.g., `boto3-stubs-lite[lambda]`), disabling PyCharm's built-in type checker in favor of `mypy` or `pyright`, or using explicit type annotations where possible.
affects: All versions
gotchaTo avoid `types-boto3-lambda` being a runtime dependency in production code, it is recommended to wrap type imports within a `typing.TYPE_CHECKING` block.fixUse `from typing import TYPE_CHECKING; if TYPE_CHECKING: from mypy_boto3_lambda.client import LambdaClient`.
affects: All versions
Upgrade
Version history
1.43.76latest on PyPI · released Aug 20, 2026
Audit
Dependencies
boto3requiredProvides the AWS SDK for Python, for which these are type stubs.
mypyoptionalA static type checker that utilizes these type stubs.
pyrightoptionalA static type checker that utilizes these type stubs.