mypy-boto3-chime

1.42.3 · active · verified Sat Apr 11

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

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted Boto3 Chime client and call an operation like `list_accounts`. It shows how to import the `ChimeClient` type and optionally type-hint the response using `TypedDict` from `mypy_boto3_chime.type_defs`. The `TYPE_CHECKING` block ensures that the stub-only imports are not part of the runtime dependency.

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')}")

view raw JSON →