mypy-boto3-dax Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-dax provides type annotations for the AWS DynamoDB Accelerator (DAX) service, compatible with `boto3`. It enhances development with static type checking, autocomplete, and improved IDE support for `boto3` DAX clients. This package is version `1.42.3`, generated by `mypy-boto3-builder` `8.12.0`, which periodically releases updates to align with new `boto3` versions and address type-related issues.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `boto3` DAX client and use its methods with type annotations provided by `mypy-boto3-dax`. Explicit type hints for the client and response are shown for clarity, though modern IDEs and `mypy` can often infer these implicitly with `mypy-boto3-dax` installed.

import boto3
from mypy_boto3_dax.client import DAXClient
from mypy_boto3_dax.type_defs import DescribeClustersResponseTypeDef

def get_dax_clusters() -> DescribeClustersResponseTypeDef:
    # boto3.client is implicitly typed by mypy-boto3-dax if installed
    # For explicit typing, use:
    client: DAXClient = boto3.client('dax')
    response: DescribeClustersResponseTypeDef = client.describe_clusters(
        MaxResults=5
    )
    return response

if __name__ == '__main__':
    # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
    try:
        clusters_info = get_dax_clusters()
        print(f"Found {len(clusters_info['Clusters'])} DAX clusters.")
        for cluster in clusters_info['Clusters']:
            print(f"  - Cluster Name: {cluster['ClusterName']}, Status: {cluster['Status']}")
    except Exception as e:
        print(f"Error fetching DAX clusters: {e}")

view raw JSON →