mypy-boto3-m2 Type Stubs for AWS Mainframe Modernization

1.42.3 · active · verified Sat Apr 11

mypy-boto3-m2 provides type annotations for the AWS Mainframe Modernization (M2) service within the boto3 library. These stubs enable static type checking for M2 clients and resources, enhancing developer productivity and catching type-related errors early. The current version is 1.42.3, generated by the mypy-boto3-builder, which maintains a regular release cadence to keep pace with boto3 updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted AWS Mainframe Modernization client using `boto3` and the `mypy-boto3-m2` stubs, then performs a simple `list_environments` operation. Mypy will validate the client's methods and argument types.

import boto3
from mypy_boto3_m2.client import MainframeModernizationClient

# Note: In a real application, consider using AWS STS or environment variables for credentials.
# For a quickstart example, boto3 uses default credential chain (env vars, ~/.aws/credentials, etc.)

# Get a typed M2 client
m2_client: MainframeModernizationClient = boto3.client("m2", region_name="us-east-1")

try:
    # Example: List environments (replace with an actual M2 operation you'd perform)
    response = m2_client.list_environments(
        maxResults=10
    )
    print(f"Successfully listed {len(response.get('environments', []))} M2 environments.")
    # Type checkers will validate arguments and response structure due to stubs
except Exception as e:
    print(f"Error listing M2 environments: {e}")

view raw JSON →