mypy-boto3-connecthealth
mypy-boto3-connecthealth provides static type annotations for the `boto3` AWS SDK's ConnectHealth service. Generated with `mypy-boto3-builder` (version 8.12.0 for the current package version), it enhances developer experience by enabling comprehensive type checking, improved IDE auto-completion, and early error detection for `boto3` code interacting with AWS ConnectHealth. The library is actively maintained with frequent updates reflecting `boto3` releases and new AWS services.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0 (November 2025). This affects all generated `mypy-boto3` stub packages, including `mypy-boto3-connecthealth` versions 1.42.x and newer. Projects using Python 3.8 or older will encounter compatibility issues.
- breaking Type definition (TypeDef) naming conventions changed in `mypy-boto3-builder` version 8.9.0 (November 2025). Type definition names for method arguments and conflicting types may have been shortened or rearranged (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). This could break existing explicit type annotations in your codebase that referenced the old names.
- gotcha `mypy-boto3-connecthealth` is a stub-only package and does not include the actual `boto3` runtime. Your application must have `boto3` installed to function at runtime. The type stubs are solely for static analysis.
- gotcha Following the migration to PEP 561 compliant packages in `mypy-boto3-builder` 8.12.0, ensure your `mypy` or other type checker is up-to-date. Older versions might not correctly discover or utilize the stubs, leading to `Missing type stub` errors or incorrect type inference.
- gotcha For optimal performance and to avoid runtime dependencies, type imports from `mypy_boto3_*` packages should ideally be placed within `if TYPE_CHECKING:` blocks. This ensures that these stub packages are only used by static analysis tools and are not treated as runtime dependencies.
- gotcha PyCharm users might experience slow performance and high CPU usage due to a known issue with Literal overloads (issue PY-40997) when using `boto3-stubs`.
Install
-
pip install mypy-boto3-connecthealth boto3 -
pip install 'boto3-stubs[connecthealth]' boto3
Imports
- ConnectHealthClient
from mypy_boto3_connecthealth.client import ConnectHealthClient
- DescribeEventsPaginator
from mypy_boto3_connecthealth.paginator import DescribeEventsPaginator
- EventTypeDef
from mypy_boto3_connecthealth.type_defs import EventTypeDef
Quickstart
from typing import TYPE_CHECKING
import boto3
import os
if TYPE_CHECKING:
from mypy_boto3_connecthealth.client import ConnectHealthClient
from mypy_boto3_connecthealth.type_defs import EventTypeDef
def get_connect_health_events(region_name: str) -> list["EventTypeDef"]:
# boto3 client creation without explicit type hint will still work
# but explicit type hints provide better IDE support and type checking
client: ConnectHealthClient = boto3.client(
"connect-health",
region_name=region_name,
aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''),
aws_session_token=os.environ.get('AWS_SESSION_TOKEN', '')
)
# Example: Describe events (Connect Health operations might require specific permissions)
try:
response = client.describe_events(
Filter={
'EventType': {'Values': ['AWS_HEALTH_EVENT']}
}
)
return response['Events']
except client.exceptions.InvalidRequestException as e:
print(f"Error describing events: {e}")
return []
if __name__ == "__main__":
events = get_connect_health_events("us-east-1")
print(f"Found {len(events)} Connect Health events.")
for event in events:
print(f" - Event ARN: {event['eventArn']}")