{"id":3636,"library":"mypy-boto3-mgn","title":"mypy-boto3-mgn","description":"mypy-boto3-mgn provides type annotations for the AWS Migration Hub rehost service (MGN) within `boto3`. It enhances development with static type checking for clients, paginators, waiters, literals, and type definitions, compatible with tools like mypy, pyright, VSCode, and PyCharm. The package is automatically generated by `mypy-boto3-builder` and is frequently updated to align with `boto3` releases.","status":"active","version":"1.42.68","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hinting","stubs","mgn"],"install":[{"cmd":"pip install mypy-boto3-mgn","lang":"bash","label":"Install service stubs"},{"cmd":"pip install 'boto3-stubs[mgn]'","lang":"bash","label":"Install via boto3-stubs extras"}],"dependencies":[{"reason":"Provides the underlying AWS SDK for Python that these type stubs annotate.","package":"boto3"},{"reason":"Requires Python 3.9 or higher due to recent removal of Python 3.8 support.","package":"python","optional":false}],"imports":[{"note":"Used for type-hinting the boto3 MGN client.","symbol":"MgnClient","correct":"from mypy_boto3_mgn import MgnClient"},{"note":"TypedDict for MGN API responses, enhancing type safety.","symbol":"ListWavesResponseTypeDef","correct":"from mypy_boto3_mgn.type_defs import ListWavesResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_mgn import MgnClient\n    from mypy_boto3_mgn.type_defs import ListWavesResponseTypeDef\n\n# Instantiate the boto3 client with type hinting\nclient: MgnClient = boto3.client(\"mgn\")\n\ntry:\n    # Example API call with typed response\n    response: ListWavesResponseTypeDef = client.list_waves(\n        maxResults=10\n    )\n    print(\"Successfully listed waves:\")\n    for wave in response.get(\"items\", []):\n        print(f\"  - Wave ID: {wave.get('waveID')}, Name: {wave.get('name')}\")\nexcept client.exceptions.ResourceNotFoundException:\n    print(\"No waves found or region misconfigured.\")\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n","lang":"python","description":"This example demonstrates how to initialize an MGN client with type annotations and make a sample API call (`list_waves`). It also shows how to type-hint the response using a generated TypeDef. The `TYPE_CHECKING` block ensures that `mypy-boto3-mgn` is only a development dependency."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If stuck on Python 3.8, you might need to pin to an older `mypy-boto3-builder` or `mypy-boto3-mgn` version (e.g., `<8.12.0` for builder).","message":"Python 3.8 support has been removed in `mypy-boto3-builder` version 8.12.0 and later. Projects using `mypy-boto3-mgn` now require Python 3.9 or higher.","severity":"breaking","affected_versions":">=8.12.0 (builder), all mypy-boto3-mgn versions generated thereafter"},{"fix":"Review your type hints for `boto3` API call parameters and responses. Adjust `TypeDef` imports and usage according to the new naming conventions. Consult the specific service documentation or generated stub files if you encounter `NameError` for `TypeDef`s.","message":"Breaking changes to `TypeDef` naming conventions occurred in `mypy-boto3-builder` version 8.9.0. Some TypeDefs for method arguments or conflicting names might have been shortened or had postfixes rearranged (e.g., `*RequestRequestTypeDef` to `*RequestTypeDef`).","severity":"breaking","affected_versions":">=8.9.0 (builder), all mypy-boto3-mgn versions generated thereafter"},{"fix":"Consider using `boto3-stubs-lite` (if explicit type annotations are acceptable) or disable PyCharm's built-in type checker in favor of `mypy` or `pyright` for linting.","message":"PyCharm users may experience slow performance or high CPU usage due to `Literal` overloads. This is a known upstream issue (PY-40997).","severity":"gotcha","affected_versions":"All versions, specific to PyCharm IDE"},{"fix":"Wrap `mypy-boto3-mgn` imports within `from typing import TYPE_CHECKING; if TYPE_CHECKING:` blocks. Alternatively, for non-`TYPE_CHECKING` contexts, assign imported types to `object`.","message":"For production deployments, `mypy-boto3-mgn` should typically be a development-only dependency. To prevent runtime import errors or `pylint` complaints about undefined variables, use `if TYPE_CHECKING:` blocks.","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"}