mypy-boto3-evidently Type Annotations

1.42.35 · active · verified Sat Apr 11

mypy-boto3-evidently provides static type annotations for the `boto3` AWS CloudWatch Evidently service client, enhancing development with type-checking capabilities. It is generated by the `mypy-boto3-builder` project and is currently at version 1.42.35. Releases are frequent, typically in sync with `boto3` updates and `mypy-boto3-builder` enhancements.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import and use `EvidentlyClient` to type-hint your `boto3` CloudWatch Evidently client. It allows your type checker (like MyPy) to validate method calls and parameter types, catching errors before runtime. It also shows importing a specific `TypeDef` for response annotations.

import boto3
from mypy_boto3_evidently import EvidentlyClient
from mypy_boto3_evidently.type_defs import CreateExperimentResponseTypeDef

# Initialize a boto3 client (ensure boto3 is installed and configured)
client: EvidentlyClient = boto3.client("evidently")

# Example usage with type hints
try:
    # This call is type-checked against the EvidentlyClient interface
    response: CreateExperimentResponseTypeDef = client.create_experiment(
        name="MyFeatureExperiment",
        project="MyProject",
        # Add other required parameters here, for example:
        # treatments=[{ 'feature': 'feature-name', 'treatmentName': 'control' }],
        # onlineAbConfig={ 'treatmentWeights': {'control': 100} }
    )
    print(f"Experiment created: {response.get('arn')}")
except client.exceptions.ConflictException:
    print("Experiment already exists.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →