{"id":3681,"library":"mypy-boto3-redshift-serverless","title":"mypy-boto3-redshift-serverless Type Stubs","description":"This package provides type annotations for the `boto3` Redshift Serverless service, generated by `mypy-boto3-builder`. It enables static type checking for your `boto3` client calls, enhancing code quality and developer experience. The current version is 1.42.28, closely tracking `boto3` releases, with frequent updates to align with new AWS service features and API changes.","status":"active","version":"1.42.28","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["boto3","aws","typing","stubs","type-hints","redshift","redshift-serverless","mypy"],"install":[{"cmd":"pip install mypy-boto3-redshift-serverless boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"These are type stubs for boto3; the boto3 library itself is required at runtime to use these stubs effectively.","package":"boto3","optional":true}],"imports":[{"note":"Client types are located in the '.client' sub-module.","wrong":"from mypy_boto3_redshift_serverless import RedshiftServerlessClient","symbol":"RedshiftServerlessClient","correct":"from mypy_boto3_redshift_serverless.client import RedshiftServerlessClient"},{"note":"All TypeDef (TypedDict) definitions are found in the '.type_defs' sub-module.","wrong":"from mypy_boto3_redshift_serverless.client import CreateNamespaceRequestRequestTypeDef","symbol":"CreateNamespaceRequestRequestTypeDef","correct":"from mypy_boto3_redshift_serverless.type_defs import CreateNamespaceRequestRequestTypeDef"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_redshift_serverless.client import RedshiftServerlessClient\nfrom mypy_boto3_redshift_serverless.type_defs import ListNamespacesResponseTypeDef\n\n# Create a boto3 client for Redshift Serverless with type hints\n# The 'type: ignore' is sometimes needed if boto3.client does not directly\n# return the exact stub type expected by mypy-boto3 in all scenarios,\n# or if you are using an older boto3 without full type-hinting support.\nredshift_client: RedshiftServerlessClient = boto3.client(\"redshift-serverless\") # type: ignore\n\ndef list_redshift_namespaces() -> ListNamespacesResponseTypeDef:\n    \"\"\"\n    Lists Redshift Serverless namespaces and returns the typed response.\n    \"\"\"\n    print(\"Calling list_namespaces...\")\n    response: ListNamespacesResponseTypeDef = redshift_client.list_namespaces()\n    \n    namespaces = response.get(\"namespaces\", [])\n    if namespaces:\n        for ns in namespaces:\n            print(f\"  Namespace Name: {ns.get('namespaceName')}, Status: {ns.get('status')}\")\n    else:\n        print(\"  No namespaces found.\")\n        \n    return response\n\nif __name__ == \"__main__\":\n    # To run this, ensure:\n    # 1. 'pip install boto3'\n    # 2. 'pip install mypy-boto3-redshift-serverless'\n    # 3. AWS credentials are configured (e.g., via ~/.aws/credentials or environment variables)\n\n    try:\n        list_redshift_namespaces()\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n        print(\"Please ensure boto3 is configured with valid AWS credentials and permissions.\")\n","lang":"python","description":"This example demonstrates how to initialize a `RedshiftServerlessClient` with type hints and call a basic operation (`list_namespaces`) while leveraging the provided `TypeDef` for the response. Ensure `boto3` and AWS credentials are configured to run successfully."},"warnings":[{"fix":"Upgrade your project's Python version to 3.9 or higher.","message":"As of `mypy-boto3-builder` version 8.12.0 (affecting `mypy-boto3-*` stub packages 1.42.x and newer), Python 3.8 is no longer supported. Projects must use Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (and corresponding stub packages)"},{"fix":"Review and update your code to use the new `TypeDef` names. Refer to the specific service's `type_defs.pyi` for current names.","message":"The `mypy-boto3-builder` (v8.9.0+) introduced breaking changes to `TypeDef` naming conventions. Argument `TypeDef` names were shortened (e.g., `CreateNamespaceRequestRequestTypeDef` to `CreateNamespaceRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `...ExtraRequestTypeDef` to `...RequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (and corresponding stub packages)"},{"fix":"Always ensure both `boto3` and `mypy-boto3-redshift-serverless` are installed (e.g., `pip install boto3 mypy-boto3-redshift-serverless`).","message":"These packages are type stubs, meaning they provide type annotations but do not include the `boto3` runtime library itself. You must install `boto3` separately alongside the `mypy-boto3-redshift-serverless` package for your code to run.","severity":"gotcha","affected_versions":"All"},{"fix":"Ensure you are using a recent version of `mypy` and `pip`. If issues persist, check `mypy`'s `MYPYPATH` configuration.","message":"The builder (v8.12.0+) migrated to PEP 561 namespace packages. This change is generally handled by `pip`, but might impact complex environments, especially those using custom `PYTHONPATH` or older `mypy` versions, causing stubs to not be found.","severity":"gotcha","affected_versions":"mypy-boto3-builder >= 8.12.0 (and corresponding stub packages)"},{"fix":"Always use the full package name, e.g., `pip install mypy-boto3-redshift-serverless` and `from mypy_boto3_redshift_serverless.client import ...`.","message":"Service-specific stub packages follow the `mypy-boto3-<service-name>` naming convention. A common mistake is trying to install or import from just `mypy-boto3` or `<service-name>-stubs`.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}