{"id":3614,"library":"mypy-boto3-lexv2-models","title":"Type Annotations for boto3 LexModelsV2","description":"mypy-boto3-lexv2-models provides comprehensive type annotations for the `boto3` LexModelsV2 service. This package, currently at version 1.42.65, is generated using `mypy-boto3-builder 8.12.0` and aims to enhance static type checking and IDE auto-completion for `boto3` users. It follows an active release cadence, typically updating in sync with `boto3` and `botocore` releases to ensure up-to-date type definitions.","status":"active","version":"1.42.65","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","lexv2","mypy","type-stubs","type-hinting"],"install":[{"cmd":"pip install mypy-boto3-lexv2-models boto3","lang":"bash","label":"Install with boto3 (runtime library)"}],"dependencies":[{"reason":"Provides the AWS SDK for Python, which this library annotates. This stub library does not provide runtime functionality itself.","package":"boto3","optional":false},{"reason":"Static type checker used to validate type annotations.","package":"mypy","optional":true}],"imports":[{"symbol":"LexModelsV2Client","correct":"from mypy_boto3_lexv2_models import LexModelsV2Client"},{"symbol":"LexModelsV2Client","correct":"from mypy_boto3_lexv2_models.client import LexModelsV2Client"},{"note":"Paginator types are specific to each paginable operation.","symbol":"Paginator","correct":"from mypy_boto3_lexv2_models.paginator import ListBotsPaginator"},{"note":"Waiter types are specific to each waitable operation.","symbol":"Waiter","correct":"from mypy_boto3_lexv2_models.waiter import BotLocaleBuiltWaiter"},{"note":"Type definitions for API request/response structures are found in `type_defs`.","symbol":"TypedDict","correct":"from mypy_boto3_lexv2_models.type_defs import BotSummaryTypeDef"},{"note":"Literal types for string-based enums are found in `literals`.","symbol":"Literal","correct":"from mypy_boto3_lexv2_models.literals import BotStatusType"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nimport os\n\nif TYPE_CHECKING:\n    from mypy_boto3_lexv2_models import LexModelsV2Client\n    from mypy_boto3_lexv2_models.type_defs import BotSummaryTypeDef\n\ndef get_lexv2_client() -> 'LexModelsV2Client':\n    \"\"\"Returns a type-hinted LexModelsV2 client.\"\"\"\n    # Ensure AWS credentials are set up (e.g., via environment variables or ~/.aws/credentials)\n    # Using os.environ.get for demonstration purposes in a runnable quickstart.\n    # In a real application, boto3 will find credentials automatically.\n    if not os.environ.get('AWS_ACCESS_KEY_ID'):\n        print(\"Warning: AWS_ACCESS_KEY_ID not set. This example may fail without credentials.\")\n\n    return boto3.client(\"lexv2\")\n\ndef list_all_lex_bots():\n    client = get_lexv2_client()\n    print(\"Listing Lex V2 bots...\")\n    try:\n        response = client.list_bots(sortBy={\n            'attribute': 'BotName',\n            'order': 'Ascending'\n        })\n        bots: list['BotSummaryTypeDef'] = response['botSummaries']\n        if bots:\n            for bot in bots:\n                print(f\"  Bot Name: {bot['botName']}, Status: {bot['botStatus']}\")\n        else:\n            print(\"  No Lex V2 bots found.\")\n    except Exception as e:\n        print(f\"Error listing bots: {e}\")\n\nif __name__ == \"__main__\":\n    list_all_lex_bots()","lang":"python","description":"This example demonstrates how to obtain a type-hinted `LexModelsV2Client` using `boto3` and then use it to list Lex V2 bots. It leverages `TYPE_CHECKING` for conditional import of the stub types, ensuring they are only used during static analysis."},"warnings":[{"fix":"Upgrade your Python interpreter to version 3.9 or higher.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder 8.12.0`, which generates this package. Ensure your environment uses Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0"},{"fix":"Update your code to use the new, shorter `TypeDef` names where applicable. Review your type hint usage for affected services.","message":"Some generated `TypeDef` names were shortened in `mypy-boto3-builder 8.9.0`. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0"},{"fix":"Ensure `boto3` is included in your project's dependencies (e.g., `pip install boto3`).","message":"This package provides only type annotations and does not include the actual `boto3` runtime library. `boto3` must be installed separately for your application to function at runtime.","severity":"gotcha","affected_versions":"all"},{"fix":"Wrap type stub imports within `if TYPE_CHECKING:` blocks, and optionally define fallback `object` types for runtime if strict Pylint rules are enabled.","message":"For Pylint compatibility and to avoid runtime dependencies on stub packages, it is recommended to conditionally import type hints using `if TYPE_CHECKING: ... else: ...` blocks.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}