{"id":3095,"library":"mypy-boto3-globalaccelerator","title":"mypy-boto3-globalaccelerator type stubs","description":"mypy-boto3-globalaccelerator provides type annotations for the boto3 GlobalAccelerator service. It helps developers leverage static type checking with Mypy for AWS Global Accelerator clients, improving code quality and catching potential errors at development time. The current version is 1.42.3, and new versions are regularly released in sync with boto3 and botocore updates.","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","globalaccelerator","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-globalaccelerator boto3","lang":"bash","label":"Install stubs and boto3"},{"cmd":"pip install mypy-boto3-globalaccelerator[globalaccelerator]","lang":"bash","label":"Install stubs with boto3 extra (not recommended, see warnings)"}],"dependencies":[{"reason":"Runtime dependency for the actual AWS SDK client. The stubs provide types for boto3.","package":"boto3","optional":false}],"imports":[{"note":"Type hints for boto3 clients are provided by mypy-boto3, not directly from boto3.","wrong":"from boto3.client import GlobalAcceleratorClient","symbol":"GlobalAcceleratorClient","correct":"from mypy_boto3_globalaccelerator.client import GlobalAcceleratorClient"},{"symbol":"CreateAcceleratorRequestTypeDef","correct":"from mypy_boto3_globalaccelerator.type_defs import CreateAcceleratorRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_globalaccelerator.client import GlobalAcceleratorClient\nfrom mypy_boto3_globalaccelerator.type_defs import CreateAcceleratorRequestTypeDef\nimport os\n\ndef create_example_accelerator(name: str) -> str:\n    \"\"\"Creates an AWS Global Accelerator accelerator.\"\"\"\n    # Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n    # The following line uses os.environ.get for illustration, boto3 handles credential lookup implicitly.\n    # AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID', '')\n    # AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY', '')\n\n    client: GlobalAcceleratorClient = boto3.client(\"globalaccelerator\", region_name=\"us-west-2\")\n\n    request_payload: CreateAcceleratorRequestTypeDef = {\n        \"Name\": name,\n        \"IpAddressType\": \"IPV4\",\n        \"Enabled\": True,\n        \"Tags\": [\n            {\"Key\": \"Project\", \"Value\": \"ChecklistDay\"},\n            {\"Key\": \"Environment\", \"Value\": \"Dev\"}\n        ],\n    }\n\n    try:\n        response = client.create_accelerator(**request_payload)\n        accelerator_arn = response[\"AcceleratorArn\"]\n        print(f\"Successfully created accelerator: {accelerator_arn}\")\n        return accelerator_arn\n    except client.exceptions.AcceleratorLimitExceededException as e:\n        print(f\"Error: Accelerator limit exceeded. {e}\")\n        return \"\"\n    except Exception as e:\n        print(f\"An unexpected error occurred: {e}\")\n        return \"\"\n\n# Example usage (requires AWS credentials and appropriate permissions)\nif __name__ == \"__main__\":\n    # For a real run, ensure your AWS environment is configured.\n    # For testing, you might mock boto3 or ensure you have a sandbox AWS account.\n    # Skipping actual execution for quickstart to avoid live resource creation.\n    # accelerator_arn = create_example_accelerator(\"MyTestGlobalAccelerator\")\n    # if accelerator_arn:\n    #     print(f\"Accelerator created with ARN: {accelerator_arn}\")\n    print(\"Quickstart example demonstrates type hinting. To run, uncomment the example usage and configure AWS credentials.\")","lang":"python","description":"This quickstart demonstrates how to use `mypy-boto3-globalaccelerator` to type-hint a `boto3` GlobalAccelerator client and its method parameters. It defines a function to create a Global Accelerator, using `GlobalAcceleratorClient` for client typing and `CreateAcceleratorRequestTypeDef` for request payload typing. Remember to have `boto3` installed and AWS credentials configured to run actual AWS operations."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Python 3.8 support was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 must upgrade to Python 3.9 or newer to continue receiving updates for `mypy-boto3-*` packages.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Ensure your Mypy version is up-to-date. If experiencing issues, verify your `pyproject.toml` or `setup.cfg` settings for `mypy`.","message":"All `mypy-boto3-*` packages migrated to PEP 561-compliant distribution in version 8.12.0. This change primarily affects how type checkers locate stubs, potentially requiring `mypy` or other tools to be updated to a version that properly handles PEP 561 packages.","severity":"breaking","affected_versions":">=8.12.0"},{"fix":"Always ensure both `pip install boto3` and `pip install mypy-boto3-globalaccelerator` are executed.","message":"The `mypy-boto3-globalaccelerator` package provides type stubs for `boto3`, but does *not* install `boto3` itself. You must explicitly install `boto3` alongside the stubs package. Using `pip install mypy-boto3-globalaccelerator[globalaccelerator]` *will* install boto3, but this is an 'extra' and less explicit than installing `boto3` separately.","severity":"gotcha","affected_versions":"all"},{"fix":"Periodically update both `boto3` and `mypy-boto3-globalaccelerator` together to their latest compatible versions.","message":"For optimal type checking accuracy, the version of `mypy-boto3-globalaccelerator` should ideally match or closely align with your installed `boto3` version. Significant version discrepancies can lead to inaccurate type hints for new or changed service features.","severity":"gotcha","affected_versions":"all"},{"fix":"Review your `type_defs` imports and update any affected `RequestRequestTypeDef` or `ExtraRequestTypeDef` names to their new, shorter forms (e.g., `CreateAcceleratorRequestTypeDef`).","message":"In `mypy-boto3-builder` version 8.9.0, type definition naming conventions changed to use shorter names where possible (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). This might break code explicitly importing the old, longer type definition names.","severity":"breaking","affected_versions":">=8.9.0"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}