{"id":1572,"library":"mypy-boto3-glue","title":"Type annotations for boto3 Glue","description":"mypy-boto3-glue provides comprehensive type annotations for the AWS boto3 Glue client, enabling static type checking with tools like MyPy, Pyright, and enhanced IDE auto-completion. It is automatically generated by mypy-boto3-builder and currently aligns with boto3 version 1.42.70, with frequent updates following new boto3 releases.","status":"active","version":"1.42.70","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["AWS","boto3","mypy","type hints","stubs","glue","type checking"],"install":[{"cmd":"pip install mypy-boto3-glue boto3","lang":"bash","label":"Install standalone stubs with boto3"},{"cmd":"pip install 'boto3-stubs[glue]' boto3","lang":"bash","label":"Install via boto3-stubs extras with boto3"}],"dependencies":[{"reason":"Provides the AWS SDK for Python, which these stubs type-annotate.","package":"boto3"},{"reason":"Primary static type checker for which these stubs are designed.","package":"mypy","optional":true},{"reason":"May be required for older Python versions to support advanced type features, though current stubs require Python 3.9+.","package":"typing-extensions","optional":true}],"imports":[{"note":"Imports the typed client for AWS Glue.","symbol":"GlueClient","correct":"from mypy_boto3_glue.client import GlueClient"},{"note":"Imports typed paginators for specific Glue operations (e.g., ListCrawlersPaginator).","symbol":"GluePaginator","correct":"from mypy_boto3_glue.paginators import ListCrawlersPaginator"},{"note":"Imports typed dictionaries for Glue service data structures (e.g., JobRunTypeDef).","symbol":"GlueTypeDef","correct":"from mypy_boto3_glue.type_defs import JobRunTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nfrom mypy_boto3_glue.client import GlueClient\n\n# Ensure boto3 is configured, e.g., via AWS environment variables or ~/.aws/credentials\n# client = boto3.client('glue') # Inferred type in modern IDEs/mypy\n\ndef get_typed_glue_client() -> GlueClient:\n    \"\"\"Returns a type-hinted Glue client.\"\"\"\n    return boto3.client('glue')\n\nif TYPE_CHECKING:\n    # Example usage with type checking\n    glue_client: GlueClient = get_typed_glue_client()\n    response = glue_client.list_crawlers(MaxResults=10)\n    for crawler in response.get('Crawlers', []):\n        print(f\"Crawler Name: {crawler.get('Name')}\")\n\nprint(\"Glue client configured. Run type checker (e.g., mypy) for full benefits.\")","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted `GlueClient` using `mypy-boto3-glue`. It leverages the `TYPE_CHECKING` guard to prevent runtime dependency on the stub package, a common practice for production environments. The primary benefit is improved auto-completion and static analysis for Glue service calls."},"warnings":[{"fix":"Upgrade your Python environment to 3.9+ or pin `mypy-boto3-glue` to a version compatible with Python 3.8 (e.g., `<1.42.70`).","message":"The underlying `mypy-boto3-builder` (version 8.12.0 and later) removed support for Python 3.8. `mypy-boto3-glue` 1.42.70 and newer officially requires Python 3.9 or higher. Projects on Python 3.8 must pin to an older version of `mypy-boto3-glue`.","severity":"breaking","affected_versions":">=1.42.70"},{"fix":"Review the `mypy_boto3_glue.type_defs` module for updated TypeDef names and adjust your explicit type annotations accordingly. For example, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`.","message":"Starting with `mypy-boto3-builder` 8.9.0, some TypeDef names for method arguments were shortened or had 'Extra' postfixes moved. This could break existing type annotations in your code if you explicitly reference these TypeDefs.","severity":"breaking","affected_versions":">=1.40.0 (roughly, depends on boto3 sync)"},{"fix":"Update your import statements to use the correct `mypy_boto3_SERVICE` package (e.g., `from mypy_boto3_glue.client import GlueClient`) or ensure `boto3-stubs[glue]` is installed.","message":"For users migrating from very old `mypy-boto3` installations (before `boto3-stubs`), the legacy `mypy-boto3` modules are no longer generated alongside `boto3-stubs` by the builder. Ensure you are importing directly from service-specific packages like `mypy_boto3_glue` or using `boto3-stubs[glue]` extras.","severity":"gotcha","affected_versions":"<8.9.0 of mypy-boto3-builder, affecting generated stubs"},{"fix":"If experiencing slow performance in PyCharm, consider installing `boto3-stubs-lite[glue]` instead of `mypy-boto3-glue` or `boto3-stubs[glue]`. This version is more RAM-friendly but might require more explicit type annotations.","message":"PyCharm users might experience performance issues due to Literal overloads. The `mypy-boto3-builder` documentation suggests using `boto3-stubs-lite` as a workaround for this known PyCharm issue.","severity":"gotcha","affected_versions":"All versions (PyCharm specific)"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}