Install & Compatibility
Where this runs
tested against v1.43.3 · 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.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 3.4s · import 0.000s · 20MB
18MB installed
● package 18MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
LexModelBuildingServiceClient
✓ from mypy_boto3_lex_models import LexModelBuildingServiceClient
✗ from mypy_boto3_lex_models.client import LexModelBuildingServiceClient
This quickstart demonstrates how to use `mypy-boto3-lex-models` to add type annotations to your boto3 client for the Lex Model Building Service. It shows importing the client type and a common response `TypeDef`, then using it to list Lex V1 bots with improved type checking and IDE support. The `TYPE_CHECKING` block ensures type imports are only active during static analysis, avoiding runtime dependencies.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_lex_models import LexModelBuildingServiceClient
from mypy_boto3_lex_models.type_defs import GetBotVersionsResponseTypeDef
def list_lex_bots_typed() -> 'GetBotVersionsResponseTypeDef':
"""Lists Lex V1 bots with type annotations."""
# Type checker/IDE will infer client type, but explicit annotation is good practice
client: LexModelBuildingServiceClient = boto3.client("lex-models")
response = client.get_bot_versions()
print(f"Found {len(response.get('bots', []))} Lex V1 bots.")
for bot in response.get('bots', []):
print(f" - {bot.get('name')} (Version: {bot.get('version')})")
return response
if __name__ == "__main__":
# Ensure AWS credentials (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION)
# are configured in your environment or ~/.aws/credentials and ~/.aws/config
list_lex_bots_typed()
Debug
Known issues
breakingPython 3.8 support was removed for all `mypy-boto3` packages with `mypy-boto3-builder 8.12.0` and later. Users must upgrade to Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or a later supported version.
affects: mypy-boto3-builder >=8.12.0 (generating mypy-boto3-* packages)
breakingPackages migrated to PEP 561. This change affects how type checkers discover and use the stubs. Ensure your type checker is configured to correctly find PEP 561 compliant packages.fixMost modern type checkers (mypy, pyright) should automatically detect PEP 561 packages. Ensure your type checker and environment are up to date.
affects: mypy-boto3-builder >=8.12.0 (generating mypy-boto3-* packages)
breakingTypeDef naming conventions changed in `mypy-boto3-builder 8.9.0`. Packed method arguments use shorter names (`CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes moved (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).fixUpdate explicit `TypeDef` references in your code to match the new naming conventions, or rely on implicit type inference where possible.
affects: mypy-boto3-builder >=8.9.0 (generating mypy-boto3-* packages)
gotchaWhile standalone `mypy-boto3-lex-models` is installable, for managing multiple AWS service stubs, `pip install 'boto3-stubs[lex-models]'` (or `types-boto3[lex-models]`) is often recommended. This keeps service stubs version-locked to `boto3` and simplifies dependency management.fixConsider using the `boto3-stubs` or `types-boto3` umbrella package with service-specific extras if you use multiple AWS services.
affects: All versions
gotchaPyCharm users might experience slow performance with Literal overloads. For better IDE responsiveness, especially with many services, consider installing the 'lite' version of stubs (e.g., `boto3-stubs-lite[lex-models]`).fixUse `pip install 'boto3-stubs-lite[lex-models]'` instead of the full version.
affects: All versions (specific to PyCharm)
gotchaWhen using `from typing import TYPE_CHECKING` guards to conditionally import stubs for Pylint compatibility, Pylint might report 'undefined variable' errors outside the `TYPE_CHECKING` block. A common workaround is to assign `object` to the type hints in the `else` branch.fixAdd an `else` branch to your `TYPE_CHECKING` guard: `else: LexModelBuildingServiceClient = object`.
affects: All versions (specific to Pylint)
Upgrade
Version history
1.43.3latest on PyPI · released May 4, 2026
Audit
Dependencies
boto3requiredRuntime dependency for the stubs to be useful; provides the actual AWS SDK functionality.
typing-extensionsoptionalMay be required for full type annotation support on older Python versions, though Python 3.9+ handles most natively.