Install & Compatibility
Where this runs
tested against v1.43.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.626s · 52MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.574s · 53MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MainframeModernizationClient
✓ from mypy_boto3_m2.client import MainframeModernizationClient
For type-hinting the M2 client obtained from boto3.client.
CreateEnvironmentInputRequestTypeDef
✓ from mypy_boto3_m2.type_defs import CreateEnvironmentInputRequestTypeDef
For explicit type-hinting of service-specific TypeDefs.
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}")
Debug
Known issues
breakingPython 3.8 support was removed from mypy-boto3-builder (version 8.12.0) and consequently from all generated stub packages, including mypy-boto3-m2 1.42.3 and newer.fixUpgrade your Python environment to 3.9 or higher. If you must use Python 3.8, pin `mypy-boto3-m2` to an older version (e.g., `<1.42.3`).
affects: mypy-boto3-m2 >=1.42.3
breakingThe `mypy-boto3-builder` migrated to PEP 561 packaging (implicit namespace packages) starting with version 8.12.0. This change affects how type checkers discover and load stubs.fixEnsure your environment and type checker (e.g., `mypy`) are up-to-date and correctly configured to handle PEP 561 compliant stub packages. Reinstalling stub packages might resolve any discovery issues.
affects: mypy-boto3-m2 >=1.42.3
gotchaThese packages provide only type stubs. You must install the actual `boto3` library for your code to run at runtime.fixAlways install `boto3` alongside `mypy-boto3-m2`: `pip install boto3 mypy-boto3-m2`.
affects: All versions
gotchaEach `mypy-boto3-<service_name>` package provides stubs only for its specific AWS service. If you use multiple AWS services, you need to install stubs for each of them.fixFor every AWS service you interact with via `boto3`, install its corresponding stub package (e.g., `mypy-boto3-s3` for S3, `mypy-boto3-ec2` for EC2).
affects: All versions
breakingTypeDef naming conventions changed in `mypy-boto3-builder` version 8.9.0 to resolve conflicts and shorten names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). If you explicitly import TypeDefs, their names might have changed.fixReview your code for explicit imports of TypeDefs (e.g., `from mypy_boto3_m2.type_defs import ...`). Consult the generated stub files or the builder's changelog for the new TypeDef names if you encounter `ImportError` or type checker errors.
affects: mypy-boto3-m2 >=1.42.3 (generated by builder >=8.9.0)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredThese packages provide type stubs for the boto3 library, so boto3 must be installed for them to be useful.