mypy-boto3-chime-sdk-media-pipelines
This library provides comprehensive type annotations for the `boto3` AWS SDK, specifically for the Chime SDK Media Pipelines service (version 1.42.3). It enhances developer experience by enabling static type checking with tools like MyPy, PyRight, and improved auto-completion in IDEs such as VSCode and PyCharm. The package is actively maintained, with releases frequently synchronized with `boto3` versions, generated by the `mypy-boto3-builder`.
Warnings
- breaking As of `mypy-boto3-builder` version 8.12.0, support for Python 3.8 has been removed across all generated `mypy-boto3` packages. Ensure your project uses Python 3.9 or newer.
- breaking Starting with `mypy-boto3-builder` version 8.12.0, packages migrated to PEP 561 standard packaging for type stubs. This primarily affects package metadata and structure but generally should be handled transparently by pip.
- breaking In `mypy-boto3-builder` version 8.9.0, `TypedDict` naming conventions were changed. Specifically, redundant `Request` suffixes were removed (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and `Extra` postfixes were moved to the end of the name. This can break existing type annotations in your code.
- gotcha The `mypy-boto3-*` packages provide *only* type annotations. You must also have `boto3` installed at runtime for your application to function, as these stubs do not include the actual AWS SDK implementation.
- gotcha It is best practice to wrap `mypy-boto3` type imports within `if TYPE_CHECKING:` blocks. This prevents `mypy-boto3` from becoming a runtime dependency, keeping your production environment lighter and avoiding potential issues with static analysis tools like Pylint.
- gotcha `mypy` treats `TypedDict` strictly. If a function expects a `TypedDict` and you pass a plain `dict`, even if its keys and values match, `mypy` will raise a type error. Explicitly instantiate `TypedDict` objects or use `typing.cast`.
- deprecated The standalone `mypy-boto3` root package is now considered 'legacy'. For a comprehensive set of stubs for multiple services, `boto3-stubs` or `types-boto3` are the recommended meta-packages for installation. Individual service packages like `mypy-boto3-chime-sdk-media-pipelines` remain the correct way to import specific client/resource types.
Install
-
pip install mypy-boto3-chime-sdk-media-pipelines boto3 -
pip install 'boto3-stubs[chime-sdk-media-pipelines]' boto3
Imports
- ChimeSDKMediaPipelinesClient
from mypy_boto3_chime_sdk_media_pipelines.client import ChimeSDKMediaPipelinesClient
- CreateMediaPipelineRequestTypeDef
from mypy_boto3_chime_sdk_media_pipelines.type_defs import CreateMediaPipelineRequestTypeDef
Quickstart
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_chime_sdk_media_pipelines.client import ChimeSDKMediaPipelinesClient
from mypy_boto3_chime_sdk_media_pipelines.type_defs import CreateMediaPipelineRequestTypeDef
def create_media_pipeline(name: str) -> dict:
# In a real application, you would pass credentials or rely on environment variables/config
# For demonstration, a client is created without explicit credentials.
client: "ChimeSDKMediaPipelinesClient" = boto3.client("chime-sdk-media-pipelines")
# Example of using a TypedDict for request parameters
request_params: "CreateMediaPipelineRequestTypeDef" = {
"DisplayName": name,
"Tags": [{"Key": "Environment", "Value": "Dev"}]
# Add other required parameters as per AWS documentation
}
# This call is for demonstration; actual Chime SDK Media Pipelines creation might require more specific parameters.
# print(f"Attempting to create media pipeline: {name}")
# response = client.create_media_pipeline(DisplayName=name, **request_params)
# print(f"Media pipeline created: {response['MediaPipeline']['MediaPipelineId']}")
# Simulate a successful response for a runnable quickstart
return {
'MediaPipeline': {
'MediaPipelineId': 'dummy-pipeline-id-123',
'MediaPipelineArn': f'arn:aws:chime::123456789012:media-pipeline/{name}/dummy-pipeline-id-123',
'DisplayName': name,
'Status': 'InProgress'
}
}
if __name__ == "__main__":
pipeline_name = "MyTestMediaPipeline"
result = create_media_pipeline(pipeline_name)
print(result)