{"id":2602,"library":"mypy-boto3-elbv2","title":"mypy-boto3-elbv2","description":"mypy-boto3-elbv2 provides static type annotations for the boto3 ElasticLoadBalancingv2 (ELBv2) service, generated with mypy-boto3-builder 8.12.0. This package enhances developer experience by enabling type checking, autocompletion, and error detection in IDEs for boto3 clients, paginators, waiters, and type definitions related to AWS ELBv2. The current version is 1.42.3, and it follows the boto3 versioning with frequent updates to align with new AWS service features.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","Boto3","Type Hinting","Mypy","Static Analysis","ELBv2","Stubs","Cloud"],"install":[{"cmd":"pip install mypy-boto3-elbv2","lang":"bash","label":"Standalone installation"},{"cmd":"pip install 'boto3-stubs[elbv2]'","lang":"bash","label":"Recommended: As part of boto3-stubs"}],"dependencies":[{"reason":"Runtime dependency for actual AWS interaction; this package only provides type stubs.","package":"boto3","optional":false},{"reason":"Required Python version.","package":"python","version":">=3.9","optional":false}],"imports":[{"symbol":"ElasticLoadBalancingv2Client","correct":"from mypy_boto3_elbv2.client import ElasticLoadBalancingv2Client"},{"symbol":"DescribeLoadBalancersOutputTypeDef","correct":"from mypy_boto3_elbv2.type_defs import DescribeLoadBalancersOutputTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_elbv2.client import ElasticLoadBalancingv2Client\nfrom mypy_boto3_elbv2.type_defs import DescribeLoadBalancersOutputTypeDef\n\ndef get_elbv2_client() -> ElasticLoadBalancingv2Client:\n    \"\"\"Returns a typed ELBv2 client.\"\"\"\n    # boto3-stubs provides auto-discovery for Session.client\n    # For standalone mypy-boto3-elbv2, explicit typing is recommended.\n    client: ElasticLoadBalancingv2Client = boto3.client(\"elbv2\")\n    return client\n\ndef list_load_balancers():\n    client = get_elbv2_client()\n    try:\n        response: DescribeLoadBalancersOutputTypeDef = client.describe_load_balancers()\n        for lb in response.get(\"LoadBalancers\", []):\n            print(f\"Load Balancer ARN: {lb['LoadBalancerArn']}, Name: {lb['LoadBalancerName']}\")\n    except client.exceptions.LoadBalancerNotFoundException:\n        print(\"No load balancers found.\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == \"__main__\":\n    list_load_balancers()","lang":"python","description":"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."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a newer supported version.","message":"Support 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.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (which generated mypy-boto3-elbv2 1.42.3 and newer)"},{"fix":"Review and update any custom code directly referencing affected `TypeDef` names.","message":"Version 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`).","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder (which generated mypy-boto3-elbv2 from that point)"},{"fix":"Use explicit type annotations for boto3 clients, resources, paginators, and waiters, especially when passing them between functions or storing them.","message":"For 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Align `mypy-boto3-elbv2` installation with your `boto3` installation. The recommended `boto3-stubs[elbv2]` installation method helps manage this.","message":"The 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider migrating to `boto3-stubs` or `types-boto3` if you are managing type annotations for multiple boto3 services.","message":"The 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.","severity":"deprecated","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}