{"id":3117,"library":"mypy-boto3-mwaa","title":"mypy-boto3-mwaa: Type Annotations for AWS MWAA","description":"mypy-boto3-mwaa provides type annotations for the `boto3` client and service resource for AWS Managed Workflows for Apache Airflow (MWAA). It is part of the `mypy-boto3` project, ensuring type safety for your AWS interactions. This package, currently at version 1.42.3, is updated frequently in tandem with 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","Type Hinting","Mypy","MWAA","Airflow","Type Stubs"],"install":[{"cmd":"pip install boto3 mypy-boto3-mwaa","lang":"bash","label":"Install Boto3 and MWAA Type Stubs"}],"dependencies":[{"reason":"This package provides type stubs for boto3; boto3 itself is required for runtime functionality.","package":"boto3","optional":false}],"imports":[{"note":"Type stubs are imported from the `mypy_boto3_mwaa` package, not directly from `boto3`.","wrong":"from boto3.client import MWAAClient","symbol":"MWAAClient","correct":"from mypy_boto3_mwaa import MWAAClient"},{"note":"Specific TypedDicts for API request/response structures are found in `type_defs`.","symbol":"CreateEnvironmentRequestRequestTypeDef","correct":"from mypy_boto3_mwaa.type_defs import CreateEnvironmentRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_mwaa import MWAAClient\nfrom mypy_boto3_mwaa.type_defs import CreateEnvironmentRequestRequestTypeDef\n\n\ndef create_mwaa_environment(\n    env_name: str, \n    bucket_name: str, \n    execution_role_arn: str\n) -> dict:\n    client: MWAAClient = boto3.client('mwaa')\n    \n    # Example of using a TypedDict for a complex request body\n    environment_config: CreateEnvironmentRequestRequestTypeDef = {\n        'Name': env_name,\n        'SourceBucketArn': f'arn:aws:s3:::{bucket_name}',\n        'ExecutionRoleArn': execution_role_arn,\n        'AirflowVersion': '2.6.3',\n        'EnvironmentClass': 'mw1.small',\n        'MaxWorkers': 1,\n        'NetworkConfiguration': {\n            'SubnetIds': ['subnet-xxxxxxxxxxxxxxxxx'], # Replace with actual subnet IDs\n            'SecurityGroupIds': ['sg-xxxxxxxxxxxxxxxxx'] # Replace with actual security group IDs\n        }\n    }\n    \n    # This call is for demonstration and requires a valid MWAA setup\n    # response = client.create_environment(**environment_config)\n    # print(f\"Environment creation initiated: {response}\")\n    \n    # For a simple type-checked call, without actual creation:\n    list_envs_response = client.list_environments()\n    print(f\"Listed MWAA environments: {list_envs_response.get('Environments')}\")\n    return list_envs_response\n\n# Example usage (requires valid AWS credentials and configuration)\n# This code will run and show type checking benefits even if the API call is commented out\nif __name__ == \"__main__\":\n    # Replace with your actual values for a real run\n    # env_name = \"my-airflow-env\"\n    # bucket_name = \"my-airflow-bucket\"\n    # execution_role_arn = \"arn:aws:iam::123456789012:role/MyMWAAExecutionRole\"\n    # create_mwaa_environment(env_name, bucket_name, execution_role_arn)\n    create_mwaa_environment(\n        'example-env', 'example-bucket', 'arn:aws:iam::123456789012:role/ExampleRole'\n    )\n","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` client for MWAA and apply the `MWAAClient` type annotation. It also shows an example of using a `TypedDict` for a request, which is common for complex `boto3` API calls. Remember to install `boto3` alongside the type stubs."},"warnings":[{"fix":"Upgrade to Python 3.9 or higher, or pin `mypy-boto3-mwaa` to an older version compatible with Python 3.8 (e.g., `<1.42.0`).","message":"Starting with `mypy-boto3-builder` version 8.12.0 (and consequently packages like `mypy-boto3-mwaa` released after it), support for Python 3.8 has been removed. Projects requiring Python 3.8 should use older versions of `mypy-boto3` packages.","severity":"breaking","affected_versions":">=8.12.0 (builder), corresponding client packages"},{"fix":"Ensure `pip install boto3==X.Y.Z mypy-boto3-mwaa==X.Y.Z` where X.Y.Z is the desired `boto3` version.","message":"The version of `mypy-boto3-mwaa` should ideally match the version of `boto3` used at runtime. Mismatched versions can lead to incorrect type hints or `mypy` errors, especially when `boto3` introduces new features or changes existing APIs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always install `boto3` alongside `mypy-boto3-mwaa` (e.g., `pip install boto3 mypy-boto3-mwaa`).","message":"This package provides *only* type annotations for `boto3`. It does not include the `boto3` library itself. You must install `boto3` separately for your application to function at runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review your `type_defs` imports after major `mypy-boto3` package upgrades and update `TypedDict` names as necessary. Rely on IDE auto-completion for correct names.","message":"The `mypy-boto3-builder` (which generates `mypy-boto3-mwaa`) sometimes changes the naming conventions for generated `TypedDict`s. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef` in `builder` v8.9.0. If you explicitly import and use specific `TypedDict` names, these changes can break your type checks.","severity":"breaking","affected_versions":"From `builder` v8.9.0 onwards, specific service `TypedDict`s"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}