mypy-boto3-chime-sdk-voice Type Annotations
This library provides type annotations for the AWS boto3 Chime SDK Voice service client. It ensures that your boto3 calls for `chime-sdk-voice` are type-checked by `mypy`, preventing common runtime errors and improving developer experience with autocompletion. The current version is 1.42.3, generated by `mypy-boto3-builder` and released frequently to align with boto3/botocore updates.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0 (which generates this stub package), Python 3.8 is no longer supported. Ensure your projects are running Python 3.9 or higher.
- breaking In builder version 8.9.0, there was a breaking change in how some TypedDict names are generated, specifically for packed method arguments. Names like `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.
- gotcha For optimal type checking, the version of `mypy-boto3-chime-sdk-voice` should ideally match the major/minor version of your installed `boto3` library. Significant mismatches can lead to incorrect type hints or missing attributes.
- gotcha When using `boto3.client('service-name')`, it's critical to explicitly type-annotate the returned client object (e.g., `client: ChimeSDKVoiceClient = boto3.client('chime-sdk-voice')`) for mypy to apply the stub types. Without this annotation, mypy treats the client as `Any`.
- gotcha If you install the general `mypy-boto3` package, it includes stubs for ALL AWS services. Installing service-specific packages (like `mypy-boto3-chime-sdk-voice`) alongside `mypy-boto3` is redundant and can lead to conflicts or larger dependency trees than necessary.
Install
-
pip install mypy-boto3-chime-sdk-voice -
pip install mypy-boto3 # for all boto3 service stubs
Imports
- ChimeSDKVoiceClient
from mypy_boto3_chime_sdk_voice.client import ChimeSDKVoiceClient
- CreateVoiceProfileDomainRequestRequestTypeDef
from mypy_boto3_chime_sdk_voice.type_defs import CreateVoiceProfileDomainRequestRequestTypeDef
Quickstart
import boto3
from mypy_boto3_chime_sdk_voice.client import ChimeSDKVoiceClient
# It's crucial to annotate the client variable for mypy to pick up the types
client: ChimeSDKVoiceClient = boto3.client("chime-sdk-voice")
# Now, 'client' methods are type-checked and offer autocompletion
try:
# Example: Listing voice profile domains
response = client.list_voice_profile_domains()
print(f"Successfully listed voice profile domains. Found {len(response['VoiceProfileDomainSummaries'])}.")
if response['VoiceProfileDomainSummaries']:
print(f"First domain name: {response['VoiceProfileDomainSummaries'][0]['Name']}")
except Exception as e:
print(f"Error listing domains (this is expected if AWS credentials/permissions are missing): {e}")
# You can also import and use specific TypedDicts for request/response bodies
# from mypy_boto3_chime_sdk_voice.type_defs import CreateVoiceProfileDomainRequestRequestTypeDef
# request_params: CreateVoiceProfileDomainRequestRequestTypeDef = {
# "Name": "MyDomain",
# "ServerSideEncryptionConfiguration": {"KmsKeyArn": "arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID"}
# }
# client.create_voice_profile_domain(**request_params)