mypy-boto3-mediatailor: Type Annotations for AWS MediaTailor
mypy-boto3-mediatailor provides PEP 561 compliant type annotations for the AWS MediaTailor service client in `boto3`. It enhances development with static type checking for `boto3` interactions, helping catch errors before runtime. This package is currently at version 1.42.84 and is part of the `mypy-boto3-builder` ecosystem, which follows a frequent release cadence, often synchronised with `boto3` updates.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0, which generated this package version. Projects using `mypy-boto3-mediatailor` 1.42.84 or newer (generated by builder 8.12.0+) require Python 3.9 or higher.
- breaking Type definition names for packed method arguments may have changed for some services. For example, `CreateDistributionRequestRequestTypeDef` might become `CreateDistributionRequestTypeDef`. This could affect code directly referencing such types.
- gotcha This package provides *only* type annotations. You must have the `boto3` library installed separately (`pip install boto3`) for your code to run at runtime. This package does not declare `boto3` as a runtime dependency.
- gotcha The `mypy-boto3` stub packages are tightly coupled with `boto3` versions. For optimal type checking, ensure your `mypy-boto3-mediatailor` version aligns with your installed `boto3` version (e.g., `mypy-boto3-mediatailor==X.Y.Z` for `boto3==X.Y.Z`).
- gotcha Avoid installing individual `mypy-boto3-*` service packages (like `mypy-boto3-mediatailor`) if you have already installed the comprehensive `boto3-stubs` package, which includes all service stubs. Installing both can lead to redundancy or potential conflicts.
Install
-
pip install mypy-boto3-mediatailor -
pip install boto3-stubs[mediatailor]
Imports
- MediaTailorClient
from mypy_boto3_mediatailor.client import MediaTailorClient
- ListChannelsResponseTypeDef
from mypy_boto3_mediatailor.type_defs import ListChannelsResponseTypeDef
- ChannelTypeDef
from mypy_boto3_mediatailor.type_defs import ChannelTypeDef
Quickstart
import boto3
from mypy_boto3_mediatailor.client import MediaTailorClient
from mypy_boto3_mediatailor.type_defs import ListChannelsResponseTypeDef
# Create a typed client for AWS MediaTailor
client: MediaTailorClient = boto3.client("mediatailor")
# Example: List channels with type hints
try:
response: ListChannelsResponseTypeDef = client.list_channels()
channels = response.get('Items', [])
print(f"Found {len(channels)} MediaTailor Channels:")
for channel in channels:
print(f"- {channel.get('ChannelName', 'N/A')} (ARN: {channel.get('ChannelArn', 'N/A')})")
except Exception as e:
print(f"Error listing channels: {e}")
print("Ensure AWS credentials and 'mediatailor' service are configured correctly.")