Registry / type-stubs / mypy-boto3-lambda

mypy-boto3-lambda

JSON →
library1.43.76pypypi✓ verified 24d ago

mypy-boto3-lambda provides type annotations for the AWS Lambda client in `boto3`, generated by `mypy-boto3-builder`. It enhances type checking for `boto3` usage, preventing common runtime errors related to incorrect AWS service calls or response parsing. The library version `1.42.85` corresponds to `boto3` version `1.42.85`. New versions are released frequently, typically mirroring `boto3` releases.

pip install mypy-boto3-lambda boto3
INSTALL
IMPORT
SIG · MYPY-BOTO3-LAMBDA
M
mypy-boto3-lambda
type-stubspythonv1.43.76
Install
4.0s avg
Import
664ms
Disk
51MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.76 · 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
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.692s · 52.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.0s · import 0.636s · 53MB
51MB installed
● package 51MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LambdaClient
from mypy_boto3_lambda.client import LambdaClient
Used for explicit type hinting of the Lambda client object.
ListFunctionsResponseTypeDef
from mypy_boto3_lambda.type_defs import ListFunctionsResponseTypeDef
Used for explicit type hinting of method response objects.

This example demonstrates how to create a type-hinted `boto3` Lambda client. `mypy` will automatically pick up the installed stubs when `boto3.client('lambda')` is called, providing autocompletion and type validation. Explicit imports for `LambdaClient` and response `TypeDef` are used for clearer annotations.

import boto3 from mypy_boto3_lambda.client import LambdaClient from mypy_boto3_lambda.type_defs import ListFunctionsResponseTypeDef # Create a typed Lambda client # mypy will automatically use the installed mypy-boto3-lambda stubs for type checking lambda_client: LambdaClient = boto3.client("lambda") try: # Example: List Lambda functions # The response object will be correctly typed response: ListFunctionsResponseTypeDef = lambda_client.list_functions(MaxItems=1) print("Successfully listed Lambda functions (first item): ") for func in response.get("Functions", []): print(f"- {func['FunctionName']}") except Exception as e: # This may happen if AWS credentials are not configured or if the user lacks permissions. print(f"Error listing Lambda functions: {e}") print("Ensure your AWS credentials are configured (e.g., via AWS CLI or environment variables).")
Debug
Known issues
breakingSupport for Python 3.8 was removed. Packages generated by `mypy-boto3-builder` v8.12.0 and later (which includes `mypy-boto3-lambda` v1.42.85) require Python 3.9 or higher.
fix
Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, you'll need to pin to older `mypy-boto3-lambda` versions, though this is not recommended due to potential `boto3` mismatches.
affects: Packages generated by `mypy-boto3-builder` v8.12.0+
breakingThe `sms-voice` service was deprecated and renamed to `pinpoint-sms-voice`. Direct usage of the `sms-voice` client will fail.
fix
Update your code to use `boto3.client("pinpoint-sms-voice")` instead of `boto3.client("sms-voice")`.
affects: Packages generated by `mypy-boto3-builder` v8.11.0+
breakingTypeDef names for packed method arguments changed, becoming shorter (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Conflicting TypeDef `Extra` postfixes also moved.
fix
Review and update explicit TypeDef annotations in your code to match the new naming conventions, or rely on implicit typing where possible and let `mypy` infer the correct types.
affects: Packages generated by `mypy-boto3-builder` v8.9.0+
gotchaThis package provides only type stubs. It is not the `boto3` library itself. You must install `boto3` separately for your code to function at runtime.
fix
Ensure `boto3` is included in your project's dependencies: `pip install boto3 mypy-boto3-lambda`.
affects: All versions
gotchaThe `mypy-boto3-*` stub packages are versioned to align with specific `boto3` versions. Using mismatched versions (e.g., `mypy-boto3-lambda` 1.42.85 with `boto3` 1.20.0) can lead to incorrect type hints or `mypy` errors.
fix
Always try to keep your `mypy-boto3-*` stub versions as close as possible to your `boto3` version. The recommended approach is to install the latest versions of both.
affects: All versions
breaking`boto3` requires an AWS region to be configured. Without a specified region, client initialization will fail.
fix
Configure an AWS region via environment variables (e.g., `AWS_REGION`), AWS shared configuration files (e.g., `~/.aws/config`), or by passing `region_name` directly to `boto3.client()` (e.g., `boto3.client('lambda', region_name='us-east-1')`).
affects: All versions
breakingBoto3 clients require an AWS region to be explicitly configured or available through environment variables/configuration files. Without a region, service client initialization will fail.
fix
Ensure an AWS region is configured either by passing `region_name='your-region'` to `boto3.client()`, setting the `AWS_DEFAULT_REGION` environment variable, or configuring it in `~/.aws/config`.
affects: All versions
Upgrade
Version history
1.43.76latest on PyPI · released Aug 20, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for `boto3`. `boto3` itself must be installed to use the Lambda client functionality at runtime.
Agent activity
22 hits · last 30 days
node
20
OpenAI (training)
1
Resources
mypy-boto3-lambda — pip install mypy-boto3-lambda · libregistry