mypy-boto3-cleanroomsml: AWS Clean Rooms ML Type Annotations for boto3

1.42.22 · active · verified Sat Apr 11

mypy-boto3-cleanroomsml provides static type annotations for the `boto3` CleanRoomsML service, enhancing code quality, readability, and error detection for Python developers working with AWS. It is generated by `mypy-boto3-builder` and is currently at version 1.42.22, with frequent updates mirroring `boto3` releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a `boto3` client for CleanRoomsML with explicit type annotations from `mypy-boto3-cleanroomsml`. It then performs a simple `list_audience_models` API call. Run `mypy your_script_name.py` to see type checking in action.

import boto3
from mypy_boto3_cleanroomsml.client import CleanRoomsMLClient

# Boto3 will pick up credentials from environment variables or ~/.aws/credentials
# This example demonstrates type hinting for the client.
client: CleanRoomsMLClient = boto3.client('cleanrooms-ml')

print("Listing CleanRooms ML audience models...")
try:
    response = client.list_audience_models(maxResults=1)
    models = response.get('audienceModelSummaries', [])
    if models:
        print(f"Found {len(models)} audience model(s). First model name: {models[0].get('name')}")
    else:
        print("No audience models found.")
except Exception as e:
    print(f"Error listing audience models: {e}")

# Example of type-checking a method call (mypy will validate arguments and return type)
# mypy will report errors if 'maxResults' was misspelled or of wrong type.
# mypy will also know the structure of `response` and its `get` methods.

view raw JSON →