Install & Compatibility
Where this runs
tested against v1.43.79 · 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.781s · 54MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 5.5s · import 0.709s · 54MB
52MB installed
● package 52MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BedrockClient
✓ from mypy_boto3_bedrock.client import BedrockClient
AgreementStatusType
✓ from mypy_boto3_bedrock.literals import AgreementStatusType
Example of importing a generated Literal type.
ModelEnforcementOutputTypeDef
✓ from mypy_boto3_bedrock.type_defs import ModelEnforcementOutputTypeDef
Example of importing a generated TypedDict.
This quickstart demonstrates how to set up type checking for the `boto3` Bedrock client using `mypy-boto3-bedrock`. It explicitly type hints the `boto3` client with `BedrockClient` and shows how to use a generated `TypeDef` for a response object, enabling static analysis and IDE autocompletion for Bedrock API calls.
import os
from typing import TYPE_CHECKING
import boto3
from boto3.session import Session
# Conditionally import type stubs only during type checking
# This avoids a runtime dependency on mypy-boto3-bedrock
if TYPE_CHECKING:
from mypy_boto3_bedrock.client import BedrockClient
from mypy_boto3_bedrock.type_defs import ListFoundationModelsResponseTypeDef
def get_bedrock_client() -> 'BedrockClient':
# Ensure AWS credentials are configured (e.g., via environment variables or AWS CLI config)
# For this example, we use a default session.
# In a real application, consider explicit credential management.
session = Session(region_name=os.environ.get('AWS_REGION', 'us-east-1'))
client: BedrockClient = session.client('bedrock')
return client
def list_bedrock_foundation_models() -> None:
client = get_bedrock_client()
print(f"Client type: {type(client)}")
try:
response: ListFoundationModelsResponseTypeDef = client.list_foundation_models()
print("Successfully listed Bedrock foundation models:")
for model in response['modelSummaries']:
print(f" - {model['modelId']} ({model['modelName']})")
except Exception as e:
print(f"Error listing models: {e}")
if __name__ == '__main__':
list_bedrock_foundation_models()
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-bedrock` 1.42.83 and newer), support for Python 3.8 has been removed. Projects using these stubs must target Python 3.9 or newer.fixUpgrade your project's Python interpreter to 3.9 or higher.
affects: mypy-boto3-builder >= 8.12.0; mypy-boto3-bedrock >= 1.42.83
breakingAll `mypy-boto3-*` packages, including `mypy-boto3-bedrock`, have migrated to PEP 561 compliant distribution. This changes how type checkers might discover and consume the stubs.fixEnsure your `mypy` or `pyright` configuration is up-to-date and correctly set up to use PEP 561 compliant stub packages. Typically, no manual action is needed beyond installing the stubs correctly.
affects: mypy-boto3-builder >= 8.12.0; mypy-boto3-bedrock >= 1.42.83
breakingService-specific `TypeDef` naming conventions changed for clarity in `mypy-boto3-builder` 8.9.0. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. This affects direct imports of generated `TypeDef` names.fixReview your explicit `TypeDef` imports and update them according to the new naming conventions. Consult the specific package's documentation for exact changes if a `TypeDef` name causes issues.
affects: mypy-boto3-builder >= 8.9.0; corresponding mypy-boto3-* packages built with it.
gotchaPyCharm users may experience performance issues with `Literal` overloads when using full `boto3-stubs` packages. The `boto3-stubs-lite` variants are recommended as a workaround for PyCharm until this issue is resolved.fixFor PyCharm, consider installing `boto3-stubs-lite[bedrock]` instead of `boto3-stubs[bedrock]` or `mypy-boto3-bedrock` directly, and explicitly annotate types. Example: `pip install 'boto3-stubs-lite[bedrock]'`.
affects: All versions, specific to PyCharm IDE.
gotchaPylint might report 'undefined variable' errors when using type stubs without `TYPE_CHECKING` guards, as it attempts to evaluate imports at runtime.fixWrap your stub imports within a `if TYPE_CHECKING:` block to ensure they are only visible to type checkers and ignored by Pylint at runtime. The quickstart example demonstrates this pattern.
affects: All versions, specific to Pylint usage.
Upgrade
Version history
1.43.79latest on PyPI · released Aug 24, 2026
Audit
Dependencies
boto3requiredThis package provides type stubs for boto3's Bedrock client. Boto3 itself must be installed by the user to execute the code that is being type-checked.