mypy-boto3-braket type stubs

1.42.85 · active · verified Sat Apr 11

mypy-boto3-braket provides static type checking and autocompletion for the AWS Braket service within the `boto3` library. It enhances developer experience by offering precise type hints for clients, paginators, waiters, and data transfer objects (TypeDefs). The current version, 1.42.85, is synchronized with its corresponding `boto3` version and is part of the actively maintained `mypy-boto3-builder` ecosystem, which follows a frequent release cadence.

Warnings

Install

Imports

Quickstart

Initialize a `boto3` Braket client and leverage the type annotations provided by `mypy-boto3-braket` for autocompletion and static type checking. This example demonstrates how to retrieve and print a list of quantum tasks.

import boto3
from mypy_boto3_braket.client import BraketClient

def get_braket_client() -> BraketClient:
    # boto3.client('braket') returns a botocore.client.Braket object at runtime.
    # mypy-boto3-braket provides the type hint to make it a BraketClient for static analysis.
    client: BraketClient = boto3.client('braket')
    return client

if __name__ == '__main__':
    # Example usage: list quantum tasks (replace with actual region/credentials if running)
    braket_client = get_braket_client()
    try:
        response = braket_client.list_quantum_tasks(
            maxResults=5,
            # Additional filtering parameters can be added here
        )
        print(f"Successfully retrieved {len(response['quantumTasks'])} quantum tasks.")
        for task in response.get('quantumTasks', []):
            print(f"  Task ARN: {task['quantumTaskArn']}, Status: {task['status']}")
    except Exception as e:
        print(f"Error listing quantum tasks: {e}")

view raw JSON →