{"id":3372,"library":"mypy-boto3-mediaconnect","title":"Type Annotations for Boto3 MediaConnect","description":"mypy-boto3-mediaconnect provides type annotations for the boto3 MediaConnect service, enhancing static analysis and IDE autocompletion for AWS MediaConnect clients. It is part of the `mypy-boto3` family of packages, currently at version 1.42.87, and is actively maintained with frequent updates mirroring boto3 releases, generated by `mypy-boto3-builder`.","status":"active","version":"1.42.87","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["type-hints","boto3","aws","mediaconnect","mypy","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-mediaconnect","lang":"bash","label":"Install service stubs"},{"cmd":"pip install boto3","lang":"bash","label":"Install runtime dependency"}],"dependencies":[{"reason":"Provides the actual runtime functionality for interacting with AWS services. `mypy-boto3-mediaconnect` only offers type hints.","package":"boto3","optional":false}],"imports":[{"note":"Imports the typed client for MediaConnect. Typically used within a `TYPE_CHECKING` block.","symbol":"MediaConnectClient","correct":"from mypy_boto3_mediaconnect.client import MediaConnectClient"},{"note":"Imports a specific TypedDict for API response structures. Names can vary, consult docs for exact TypedDicts.","symbol":"FlowSummaryTypeDef","correct":"from mypy_boto3_mediaconnect.type_defs import FlowSummaryTypeDef"}],"quickstart":{"code":"from typing import TYPE_CHECKING\nimport boto3\nimport os\n\nif TYPE_CHECKING:\n    from mypy_boto3_mediaconnect.client import MediaConnectClient\n    from mypy_boto3_mediaconnect.type_defs import ListFlowsResponseTypeDef\n\n# Ensure AWS credentials are set up (e.g., via environment variables or ~/.aws/credentials)\n# For example, by setting AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY\n\ndef list_mediaconnect_flows() -> list[str]:\n    try:\n        # The type annotation helps your IDE and static checker understand the client's methods\n        client: MediaConnectClient = boto3.client(\n            \"mediaconnect\",\n            aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'DUMMY_KEY'),\n            aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'DUMMY_SECRET'),\n            region_name=os.environ.get('AWS_DEFAULT_REGION', 'us-east-1')\n        )\n        response: ListFlowsResponseTypeDef = client.list_flows()\n        flow_names = [flow['Name'] for flow in response.get('Flows', []) if 'Name' in flow]\n        print(f\"Found MediaConnect flows: {flow_names}\")\n        return flow_names\n    except Exception as e:\n        print(f\"Error listing MediaConnect flows: {e}\")\n        return []\n\nif __name__ == \"__main__\":\n    list_mediaconnect_flows()","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-mediaconnect` to add type hints to your boto3 MediaConnect client. It initializes a typed client and lists available MediaConnect flows, leveraging the `TYPE_CHECKING` guard to prevent runtime dependency on the stub package. Remember to have `boto3` installed and AWS credentials configured for actual execution."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Support for Python 3.8 was removed from `mypy-boto3-builder` version 8.12.0, meaning `mypy-boto3-mediaconnect` packages generated by this builder version or newer will not support Python 3.8.","severity":"breaking","affected_versions":"mypy-boto3-mediaconnect >= 1.42.87 (generated by builder 8.12.0+)"},{"fix":"Review your code for any custom `TypeDef` imports and update their names according to the new conventions.","message":"There were breaking changes in `TypeDef` naming conventions in `mypy-boto3-builder` version 8.9.0. Specifically, `TypeDef` names for packed method arguments became shorter (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved to the end.","severity":"breaking","affected_versions":"mypy-boto3-mediaconnect generated by builder 8.9.0+"},{"fix":"Ensure `pip install boto3` is part of your project's dependency management.","message":"This package provides *only* type stubs. For your code to run, you must also install the `boto3` library, as `mypy-boto3-mediaconnect` does not include the runtime implementation.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `from typing import TYPE_CHECKING; if TYPE_CHECKING: from mypy_boto3_mediaconnect.client import MediaConnectClient` for all type imports.","message":"To avoid making `mypy-boto3-mediaconnect` a runtime dependency, which is unnecessary overhead, always wrap your type imports within a `if TYPE_CHECKING:` block.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Add explicit type annotations to `boto3.client` and `boto3.session.client` calls for better developer experience.","message":"For optimal IDE autocompletion and type checking (especially in VSCode), it is recommended to explicitly annotate the client object when creating it, e.g., `client: MediaConnectClient = boto3.client(\"mediaconnect\")`.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}