Install & Compatibility
Where this runs
tested against v1.43.54 · 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 · 19.9MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.5s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
ElasticLoadBalancingv2Client
✓ from mypy_boto3_elbv2 import ElasticLoadBalancingv2Client
✗ from mypy_boto3_elbv2 import ElasticLoadBalancingv2Client
This quickstart demonstrates how to initialize a type-hinted ELBv2 client and use it to describe load balancers, leveraging the provided type definitions for improved code quality and IDE support.
import boto3
from mypy_boto3_elbv2.client import ElasticLoadBalancingv2Client
from mypy_boto3_elbv2.type_defs import DescribeLoadBalancersOutputTypeDef
def get_elbv2_client() -> ElasticLoadBalancingv2Client:
"""Returns a typed ELBv2 client."""
# boto3-stubs provides auto-discovery for Session.client
# For standalone mypy-boto3-elbv2, explicit typing is recommended.
client: ElasticLoadBalancingv2Client = boto3.client("elbv2")
return client
def list_load_balancers():
client = get_elbv2_client()
try:
response: DescribeLoadBalancersOutputTypeDef = client.describe_load_balancers()
for lb in response.get("LoadBalancers", []):
print(f"Load Balancer ARN: {lb['LoadBalancerArn']}, Name: {lb['LoadBalancerName']}")
except client.exceptions.LoadBalancerNotFoundException:
print("No load balancers found.")
except Exception as e:
print(f"An error occurred: {e}")
if __name__ == "__main__":
list_load_balancers()
Debug
Known issues
breakingSupport for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 or older must upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or a newer supported version.
affects: >=8.12.0 of mypy-boto3-builder (which generated mypy-boto3-elbv2 1.42.3 and newer)
breakingVersion 8.9.0 of `mypy-boto3-builder` introduced breaking changes in TypeDef naming conventions. Specifically, TypeDefs for packed method arguments use shorter names (`CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved to the end (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).fixReview and update any custom code directly referencing affected `TypeDef` names.
affects: >=8.9.0 of mypy-boto3-builder (which generated mypy-boto3-elbv2 from that point)
gotchaFor optimal IDE autocompletion and type checking, especially when using `mypy-boto3-elbv2` as a standalone package or `boto3-stubs-lite`, it is often necessary to explicitly annotate the client type (e.g., `client: ElasticLoadBalancingv2Client = boto3.client("elbv2")`). While `boto3-stubs` (the meta-package) aims for implicit type discovery, explicit annotations provide the most reliable experience.fixUse explicit type annotations for boto3 clients, resources, paginators, and waiters, especially when passing them between functions or storing them.
affects: All versions
gotchaThe version of `mypy-boto3-elbv2` is synchronized with the `boto3` version it provides stubs for (e.g., `mypy-boto3-elbv2 1.42.3` corresponds to `boto3 1.42.3`). Ensure your `mypy-boto3-elbv2` version matches or is compatible with your installed `boto3` version to avoid type checking inconsistencies.fixAlign `mypy-boto3-elbv2` installation with your `boto3` installation. The recommended `boto3-stubs[elbv2]` installation method helps manage this.
affects: All versions
deprecatedThe original `mypy-boto3` top-level package is considered legacy. While `mypy-boto3-elbv2` (the service-specific stub) is still actively maintained and generated by `mypy-boto3-builder`, users are encouraged to use the `boto3-stubs` or `types-boto3` packages (e.g., `pip install 'boto3-stubs[elbv2]'`) for a more consolidated and officially recommended approach to type annotations.fixConsider migrating to `boto3-stubs` or `types-boto3` if you are managing type annotations for multiple boto3 services.
affects: All versions
Upgrade
Version history
1.43.54latest on PyPI · released Jul 22, 2026
Audit
Dependencies
boto3requiredRuntime dependency for actual AWS interaction; this package only provides type stubs.
pythonrequiredRequired Python version.