Registry / type-stubs / mypy-boto3-lex-runtime

mypy-boto3-lex-runtime

JSON →
library1.43.0pypypi✓ verified 22d ago

mypy-boto3-lex-runtime provides high-quality type annotations for the boto3 LexRuntimeService. Currently at version 1.42.3, this library is part of the larger mypy-boto3 project, which automatically generates stubs for all AWS services. It's updated frequently, typically aligning with new boto3 releases and enhancements in the mypy-boto3-builder.

pip install mypy-boto3-lex-runtime
INSTALL
IMPORT
SIG · MYPY-BOTO3-LEX-RUN
M
mypy-boto3-lex-runtime
type-stubspythonv1.43.0
Install
3.6s avg
Import
Disk
232MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.0 · 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.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 198.8MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 3.6s · import 0.000s · 267MB
232MB installed
● package 232MB
Code
Verified usage

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

LexRuntimeServiceClient
from mypy_boto3_lex_runtime import LexRuntimeServiceClient
from mypy_boto3_lex_runtime import LexRuntimeServiceClient

This quickstart demonstrates how to initialize a `boto3` Lex Runtime client and make a `post_text` call with `mypy-boto3-lex-runtime` type annotations. The `TYPE_CHECKING` guard ensures that stub imports are only processed by the type checker, which can improve runtime performance and robustness if `mypy-boto3` is primarily a development dependency.

import os import boto3 from typing import TYPE_CHECKING # Import specific types only when type checking using TYPE_CHECKING guard if TYPE_CHECKING: from mypy_boto3_lex_runtime.client import LexRuntimeServiceClient from mypy_boto3_lex_runtime.type_defs import PostTextRequestRequestTypeDef, PostTextResponseTypeDef # Configure AWS credentials (for demonstration, use environment variables or default config) # In a real application, consider using AWS IAM roles or standard AWS configuration. aws_access_key_id = os.environ.get("AWS_ACCESS_KEY_ID", "MOCK_ACCESS_KEY") aws_secret_access_key = os.environ.get("AWS_SECRET_ACCESS_KEY", "MOCK_SECRET_KEY") aws_region = os.environ.get("AWS_REGION", "us-east-1") # Initialize the Lex Runtime client with type annotation. # The '"LexRuntimeServiceClient"' uses a string forward reference, common with TYPE_CHECKING. client: "LexRuntimeServiceClient" = boto3.client( "lex-runtime", region_name=aws_region, aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, ) # Define request parameters using TypedDicts for type safety. # Replace 'YourLexBotName' with your actual Amazon Lex bot's name. request_params: "PostTextRequestRequestTypeDef" = { "botName": "YourLexBotName", "botAlias": "$LATEST", "userId": "testuser123", "inputText": "Hello, what is your name?", } # Call a client method; mypy will check arguments and return type response: "PostTextResponseTypeDef" = client.post_text(**request_params) print(f"Lex Runtime PostText Response: {response}") # Access typed fields from the response message_content = response.get("message") print(f"Bot's message: {message_content}")
Debug
Known issues
breakingPython 3.8 support was officially removed with mypy-boto3-builder version 8.12.0 (released alongside mypy-boto3-lex-runtime versions around 1.30.0+). Projects still utilizing Python 3.8 will encounter compatibility issues.
fix
Upgrade your Python environment to version 3.9 or newer to ensure compatibility and receive updates.
affects: mypy-boto3-builder>=8.12.0
breakingType definition naming conventions were refactored in mypy-boto3-builder 8.9.0. This included shortening redundant TypeDef suffixes (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`) and moving conflicting `Extra` postfixes. This can break explicit type imports in existing codebases.
fix
Review and update your type import paths and TypeDef names according to the new conventions. The service's `type_defs.pyi` file provides the authoritative names.
affects: mypy-boto3-builder>=8.9.0
gotchaThese packages provide only type stubs for `boto3`. For your application to run, you must install the actual `boto3` library. For static analysis, you also need to install `mypy`.
fix
Ensure both `boto3` and `mypy` are installed in your project environment (e.g., `pip install boto3 mypy`), in addition to `mypy-boto3-lex-runtime`.
affects: All versions
gotchaTo leverage these type stubs, you must actively run `mypy` (or another compatible static type checker) as part of your development or CI/CD workflow. The stubs themselves do not add runtime type enforcement.
fix
Integrate `mypy` into your project's checks. Example: `mypy your_project/`.
affects: All versions
gotchaThe `mypy-boto3` packages migrated to the PEP 561 standard for Python type stubs with `mypy-boto3-builder` version 8.12.0. While this is a positive change for compatibility, it might affect certain older build systems or tools that had specific assumptions about non-PEP 561 package structures.
fix
Ensure your Python environment, package manager, and development tools are up-to-date and compatible with PEP 561 standards. No specific code change is typically required.
affects: mypy-boto3-builder>=8.12.0
deprecatedAWS services can be deprecated or renamed (e.g., `sms-voice` service was replaced by `pinpoint-sms-voice` in builder 8.11.0). While Lex Runtime is generally stable, future `mypy-boto3` versions will reflect any such changes in AWS service availability or APIs, which could break old service imports.
fix
Regularly consult `mypy-boto3` release notes for service-specific changes and update your code, imports, and API calls accordingly if using affected services.
affects: All versions
gotchaIt is recommended to wrap `mypy-boto3` type imports in `if TYPE_CHECKING:` blocks. This prevents loading potentially large stub modules at runtime, which can be beneficial for performance and robustness if the stubs are only a development dependency.
fix
Modify your code to import types conditionally: `from typing import TYPE_CHECKING; if TYPE_CHECKING: from mypy_boto3_lex_runtime.client import LexRuntimeServiceClient`.
affects: All versions
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredRuntime dependency for the AWS SDK, which these stubs type-check.
mypyoptionalStatic type checker required to utilize these stubs.
typing-extensionsoptionalRuntime dependency for advanced type features, often used for compatibility.
Agent activity
27 hits · last 30 days
node
24
OpenAI (training)
2
Resources
mypy-boto3-lex-runtime — pip install mypy-boto3-lex-runtime · libregistry