mypy-boto3-chime
mypy-boto3-chime provides comprehensive type annotations for the AWS Boto3 Chime service, enabling static type checking with tools like MyPy. It enhances code quality, readability, and error detection for Boto3 interactions. The library is currently at version 1.42.3 and is automatically generated by the mypy-boto3-builder.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. This affects all generated `mypy-boto3` stub packages, including `mypy-boto3-chime`.
- breaking The legacy `mypy-boto3` project was moved to a separate product in `mypy-boto3-builder` version 8.9.0. Users relying on the older `mypy-boto3` package for broad stub coverage may experience issues.
- breaking Type definition names for method arguments (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`) and `Extra` postfix positioning were changed in `mypy-boto3-builder` version 8.9.0. This can cause type checking errors for existing code.
- gotcha This package only provides type annotations. You must install the `boto3` library separately for runtime functionality.
- gotcha For static type checking to be effective, you need to configure a type checker like MyPy or Pyright in your project. This package provides the stubs, but the type checker performs the analysis.
- deprecated The `sms-voice` service was excluded from `mypy-boto3-builder` version 8.11.0 and is no longer supported. Users should use `pinpoint-sms-voice` instead. While this specific package is for Chime, it indicates a pattern of service name changes in the broader `mypy-boto3` ecosystem.
Install
-
pip install mypy-boto3-chime boto3
Imports
- ChimeClient
from mypy_boto3_chime.client import ChimeClient
- ListAccountsOutputTypeDef
from mypy_boto3_chime.type_defs import ListAccountsOutputTypeDef
- AccountStatusType
from mypy_boto3_chime.literals import AccountStatusType
Quickstart
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_chime.client import ChimeClient
from mypy_boto3_chime.type_defs import ListAccountsOutputTypeDef
def get_chime_accounts() -> list[dict]:
# The client variable is type-hinted for MyPy/IDE support
client: "ChimeClient" = boto3.client("chime")
# The response can also be type-hinted for stricter checking
response: "ListAccountsOutputTypeDef" = client.list_accounts(
MaxResults=5,
NextToken='' # Simulate optional token, use os.environ.get('NEXT_TOKEN', '') for real-world scenarios
)
return response.get("Accounts", [])
if __name__ == "__main__":
accounts = get_chime_accounts()
print(f"Found {len(accounts)} Chime accounts.")
for account in accounts:
print(f" Account ID: {account.get('AccountId')}, Name: {account.get('Name')}")