mypy-boto3-mailmanager
mypy-boto3-mailmanager provides type annotations for the `boto3` MailManager service, enabling static type checking with tools like MyPy and enhanced IDE auto-completion. It is part of the `mypy-boto3` ecosystem, automatically generated by `mypy-boto3-builder 8.12.0`, and keeps pace with `boto3` updates to ensure all available MailManager service methods, clients, paginators, literals, and type definitions are fully type-annotated. The current version is 1.42.80.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0, which generated this package. `mypy-boto3-mailmanager` now requires Python 3.9 or higher.
- breaking The `mypy-boto3` ecosystem migrated to PEP 561-compatible packages in `mypy-boto3-builder` 8.12.0. This change affects how type checkers discover and prioritize type information. Stub-only packages are now the standard, superseding any inline types in the runtime library if present.
- breaking In `mypy-boto3-builder` 8.9.0, a breaking change was introduced for TypeDef naming conventions. Some packed method arguments or conflicting TypeDefs had their names shortened or adjusted (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This *could* affect TypeDefs within MailManager if it had similarly named long type definitions.
- gotcha `mypy-boto3-mailmanager` provides *only* type stubs. It does not include the `boto3` runtime library itself. `boto3` must be installed separately in your project for your code to function.
- gotcha For optimal type checking and IDE auto-completion, especially with `boto3.client()` and `boto3.session.client()`, it is highly recommended to use explicit type annotations for your client objects.
- gotcha To prevent `mypy-boto3-mailmanager` from becoming a runtime dependency in production environments, encapsulate its imports within a `if TYPE_CHECKING:` block. This ensures the imports are only processed by type checkers and ignored at runtime.
Install
-
pip install mypy-boto3-mailmanager boto3 -
pip install 'boto3-stubs[mailmanager]' boto3
Imports
- MailManagerClient
from mypy_boto3_mailmanager import MailManagerClient
Quickstart
from typing import TYPE_CHECKING
import boto3
import os
if TYPE_CHECKING:
from mypy_boto3_mailmanager import MailManagerClient
from mypy_boto3_mailmanager.type_defs import CreateAddonResponseTypeDef
def create_mail_manager_client() -> 'MailManagerClient':
"""Creates a typed MailManager client."""
session = boto3.session.Session(
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),
region_name=os.environ.get('AWS_REGION', 'us-east-1')
)
# Explicit type annotation helps mypy and IDEs
client: MailManagerClient = session.client('mailmanager')
return client
def list_mail_manager_addons():
"""Lists MailManager addons with type-checked client."""
client = create_mail_manager_client()
try:
response = client.list_addons(PageSize=10)
# Using TypeDef for response provides further type safety
addons: list[dict] = response.get('Addons', [])
print(f"Found {len(addons)} MailManager addons.")
for addon in addons:
print(f" Addon ID: {addon.get('AddonId')}")
except client.exceptions.ClientError as e:
print(f"Error listing addons: {e}")
if __name__ == '__main__':
list_mail_manager_addons()