{"id":3127,"library":"mypy-boto3-redshift","title":"mypy-boto3-redshift Type Annotations","description":"mypy-boto3-redshift provides explicit type annotations for the `boto3` Redshift service, enhancing static analysis with tools like mypy, pyright, and various IDEs. Generated by `mypy-boto3-builder`, it offers comprehensive type hinting for Redshift clients, paginators, waiters, and associated type definitions. The library is actively maintained and kept in sync with upstream `boto3` releases.","status":"active","version":"1.42.42","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","redshift","typing","stubs","mypy","type-checking","python"],"install":[{"cmd":"pip install mypy-boto3-redshift","lang":"bash","label":"Standalone installation"},{"cmd":"pip install 'boto3-stubs[redshift]'","lang":"bash","label":"Recommended: As part of boto3-stubs"},{"cmd":"pip install mypy-boto3 boto3","lang":"bash","label":"Ensure boto3 is also installed"}],"dependencies":[{"reason":"Provides the runtime AWS SDK that these type stubs annotate.","package":"boto3"},{"reason":"The primary static type checker this library aims to support.","package":"mypy","optional":true},{"reason":"Required for some type features on Python versions < 3.9, automatically handled by install_requires.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"RedshiftClient","correct":"from mypy_boto3_redshift.client import RedshiftClient"},{"symbol":"DescribeClustersResponseTypeDef","correct":"from mypy_boto3_redshift.type_defs import DescribeClustersResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_redshift.client import RedshiftClient\nfrom mypy_boto3_redshift.type_defs import DescribeClustersResponseTypeDef\n\ndef get_redshift_client() -> RedshiftClient:\n    \"\"\"Initializes and returns a type-hinted Redshift client.\"\"\"\n    # boto3.client returns a Client, which mypy_boto3_redshift annotates\n    client: RedshiftClient = boto3.client(\"redshift\")\n    return client\n\ndef describe_redshift_clusters(client: RedshiftClient) -> DescribeClustersResponseTypeDef:\n    \"\"\"Describes Redshift clusters with type hinting.\"\"\"\n    response: DescribeClustersResponseTypeDef = client.describe_clusters(\n        ClusterIdentifier='my-redshift-cluster' # Replace with actual cluster ID\n    )\n    return response\n\nif __name__ == \"__main__\":\n    redshift_client = get_redshift_client()\n    try:\n        clusters_info = describe_redshift_clusters(redshift_client)\n        print(f\"Found {len(clusters_info['Clusters'])} Redshift clusters.\")\n        for cluster in clusters_info['Clusters']:\n            print(f\"  - Cluster: {cluster['ClusterIdentifier']} Status: {cluster['ClusterStatus']}\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")","lang":"python","description":"This example demonstrates how to initialize a `boto3` Redshift client and call `describe_clusters` with full type annotations provided by `mypy-boto3-redshift`. It explicitly imports `RedshiftClient` for the client object and `DescribeClustersResponseTypeDef` for the response, enabling static analysis and IDE auto-completion."},"warnings":[{"fix":"Upgrade to Python 3.9+ or use an older version of the library compatible with Python 3.8.","message":"Support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 should either upgrade their Python version or pin `mypy-boto3-redshift` (and `boto3-stubs` if used) to an older version (e.g., <8.12.0 of the builder generation, which corresponds to `mypy-boto3-redshift` version prior to 1.42.42).","severity":"breaking","affected_versions":"<8.12.0 of mypy-boto3-builder, and consequently mypy-boto3-redshift versions prior to 1.42.42 (released with builder 8.12.0)."},{"fix":"Ensure your type checker (e.g., `mypy`) is up-to-date and installed in the same environment as `mypy-boto3-redshift` to ensure correct stub discovery. No user-level code change is typically required for standard `boto3` usage.","message":"The `mypy-boto3` family of packages (including `mypy-boto3-redshift`) migrated to PEP 561 compliant packages with `mypy-boto3-builder` 8.12.0. This change affects how type checkers discover stubs and generally improves compatibility, but older type checker configurations or environments might need adjustments.","severity":"breaking","affected_versions":"All packages generated by `mypy-boto3-builder` 8.12.0 and later."},{"fix":"Ensure `boto3` is installed: `pip install boto3`.","message":"`mypy-boto3-redshift` provides only type *stubs*. For your Python code to actually interact with AWS Redshift, you must have the `boto3` library itself installed in your environment. These stubs enhance `boto3` with type checking, but do not replace it.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider using `boto3-stubs-lite` (e.g., `pip install 'boto3-stubs-lite[redshift]'`) which is more RAM-friendly but might require more explicit type annotations. Alternatively, disable PyCharm's built-in type checker and rely on external tools like `mypy` or `pyright`.","message":"When using `mypy-boto3` stubs with PyCharm, there can be performance issues and high CPU usage due to PyCharm's handling of `Literal` overloads (issue PY-40997). This can lead to a slow IDE experience.","severity":"gotcha","affected_versions":"All versions, specifically impacting PyCharm users."},{"fix":"Update imports and type annotation references in your code to match the new, shortened `TypeDef` names. Consult the specific service's documentation for the exact new names if encountered.","message":"With `mypy-boto3-builder` version 8.9.0, some generated `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). Code explicitly importing or referencing these generated type definition names may break.","severity":"breaking","affected_versions":"All packages generated by `mypy-boto3-builder` 8.9.0 and later."}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}