{"id":3116,"library":"mypy-boto3-mq","title":"mypy-boto3-mq","description":"mypy-boto3-mq provides type annotations for the AWS Boto3 MQ service client, enabling static type checking with tools like mypy, Pyright, and enhanced IDE autocompletion for `boto3.client('mq')`. It is a standalone stub package generated by the `mypy-boto3-builder` tool. The version (1.42.3) aligns with the corresponding `boto3` version, ensuring compatibility, and it is actively maintained with updates mirroring new `boto3` releases.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","boto3","mypy","type-hints","stubs","MQ","Amazon MQ"],"install":[{"cmd":"pip install mypy-boto3-mq boto3","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the underlying AWS SDK for Python, which these stubs type-annotate.","package":"boto3"},{"reason":"Primary static type checker that utilizes these stub files.","package":"mypy","optional":true}],"imports":[{"note":"The `MQClient` type definition comes from the `mypy-boto3-mq` stub package, not directly from `boto3` itself. While IDEs might implicitly suggest types, explicit import ensures strict type checking.","wrong":"from boto3.client import MQClient","symbol":"MQClient","correct":"from mypy_boto3_mq import MQClient\nimport boto3\n\nclient: MQClient = boto3.client(\"mq\")"},{"note":"Type definitions for API responses and request parameters are found in `type_defs` submodules for explicit typing.","symbol":"ListBrokersResponseTypeDef","correct":"from mypy_boto3_mq.type_defs import ListBrokersResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_mq import MQClient\nfrom mypy_boto3_mq.type_defs import ListBrokersResponseTypeDef\nimport os\n\n# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n# For example, by setting AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION\n# os.environ['AWS_REGION'] = os.environ.get('AWS_REGION', 'us-east-1')\n\ndef list_mq_brokers() -> None:\n    client: MQClient = boto3.client(\"mq\")\n    \n    try:\n        # Example: List Amazon MQ brokers\n        response: ListBrokersResponseTypeDef = client.list_brokers()\n        brokers = response.get('BrokerSummaries', [])\n        \n        if brokers:\n            print(\"Amazon MQ Brokers found:\")\n            for broker in brokers:\n                print(f\"  - Name: {broker.get('BrokerName')}, ARN: {broker.get('BrokerArn')}\")\n        else:\n            print(\"No Amazon MQ brokers found.\")\n\n    except client.exceptions.ClientError as e:\n        print(f\"Error listing brokers: {e}\")\n\nif __name__ == \"__main__\":\n    list_mq_brokers()","lang":"python","description":"Demonstrates how to initialize an MQ client with type hints and call a basic operation like `list_brokers()`. Ensure `boto3` is installed and AWS credentials are configured in your environment."},"warnings":[{"fix":"Upgrade Python to 3.9+ or pin `mypy-boto3-mq` to a version generated by `mypy-boto3-builder <8.12.0`.","message":"Starting with `mypy-boto3-builder` version 8.12.0 (which generates `mypy-boto3-mq`), Python 3.8 is no longer supported. Projects requiring Python 3.8 should use older versions of `mypy-boto3-mq` or upgrade their Python interpreter.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Ensure your project setup and build tools are up-to-date and correctly configured to discover PEP 561 stubs.","message":"The `mypy-boto3-builder` (from version 8.12.0) migrated to PEP 561 compliant packaging. While generally beneficial, this change could potentially affect stub discovery in environments using older or non-standard build systems.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0"},{"fix":"Update imports and references to TypeDefs to match the new naming conventions, or pin to an older `mypy-boto3-mq` version.","message":"With `mypy-boto3-builder` version 8.9.0, type definition naming conventions were changed. Specifically, TypeDefs for packed method arguments use shorter names, and conflicting TypeDef `Extra` postfixes were moved to the end. If your code explicitly imported or referenced these generated TypeDefs by their full names, it will break.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0"},{"fix":"Consider using `boto3-stubs-lite` if PyCharm performance is an issue, or disable specific linting rules in PyCharm.","message":"PyCharm users might experience slow performance with Literal overloads in type hints. The `boto3-stubs-lite` package is recommended as a workaround until the upstream PyCharm issue (PY-40997) is resolved. This generally applies to all `mypy-boto3` generated stubs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To resolve Pylint complaints, set the type-hinted variables to `object` in the `else` block of your `TYPE_CHECKING` guard: `if TYPE_CHECKING: from mypy_boto3_mq import MQClient else: MQClient = object`.","message":"When using `TYPE_CHECKING` guards to avoid runtime dependencies, Pylint might report 'undefined variable' errors for the type-hinted objects.","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"}