{"id":3347,"library":"mypy-boto3-cleanroomsml","title":"mypy-boto3-cleanroomsml: AWS Clean Rooms ML Type Annotations for boto3","description":"mypy-boto3-cleanroomsml provides static type annotations for the `boto3` CleanRoomsML service, enhancing code quality, readability, and error detection for Python developers working with AWS. It is generated by `mypy-boto3-builder` and is currently at version 1.42.22, with frequent updates mirroring `boto3` releases.","status":"active","version":"1.42.22","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","cleanroomsml","stubs","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-cleanroomsml boto3 mypy","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"Provides the actual runtime AWS SDK for Python that these type stubs annotate.","package":"boto3"},{"reason":"Required for static type checking to utilize these type annotations.","package":"mypy","optional":true},{"reason":"The tool used to generate these type stubs; not a runtime dependency for users of the stubs.","package":"mypy-boto3-builder","optional":true}],"imports":[{"symbol":"CleanRoomsMLClient","correct":"from mypy_boto3_cleanroomsml.client import CleanRoomsMLClient"},{"note":"mypy-boto3-cleanroomsml provides type stubs, not a runtime client. The actual client is obtained from the boto3 library. Explicit type annotation for the client is often recommended for better IDE support.","wrong":"from mypy_boto3_cleanroomsml import client","symbol":"boto3.client","correct":"import boto3\nclient: CleanRoomsMLClient = boto3.client('cleanrooms-ml')"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_cleanroomsml.client import CleanRoomsMLClient\n\n# Boto3 will pick up credentials from environment variables or ~/.aws/credentials\n# This example demonstrates type hinting for the client.\nclient: CleanRoomsMLClient = boto3.client('cleanrooms-ml')\n\nprint(\"Listing CleanRooms ML audience models...\")\ntry:\n    response = client.list_audience_models(maxResults=1)\n    models = response.get('audienceModelSummaries', [])\n    if models:\n        print(f\"Found {len(models)} audience model(s). First model name: {models[0].get('name')}\")\n    else:\n        print(\"No audience models found.\")\nexcept Exception as e:\n    print(f\"Error listing audience models: {e}\")\n\n# Example of type-checking a method call (mypy will validate arguments and return type)\n# mypy will report errors if 'maxResults' was misspelled or of wrong type.\n# mypy will also know the structure of `response` and its `get` methods.\n","lang":"python","description":"This quickstart demonstrates how to initialize a `boto3` client for CleanRoomsML with explicit type annotations from `mypy-boto3-cleanroomsml`. It then performs a simple `list_audience_models` API call. Run `mypy your_script_name.py` to see type checking in action."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or later.","message":"Python 3.8 support has been removed since `mypy-boto3-builder` version 8.12.0. Users must use Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (and generated stubs like mypy-boto3-cleanroomsml)"},{"fix":"Review and update `TypedDict` import paths and names, e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`. Examine the specific service's `type_defs` module for exact names.","message":"TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. This might affect code directly importing and referencing `TypedDict` definitions from the stubs.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0 (and generated stubs)"},{"fix":"Always install and use `boto3` for actual AWS API interactions. `mypy-boto3-cleanroomsml` is a development dependency for type checking only.","message":"These are type stubs, not runtime code. `mypy-boto3-cleanroomsml` does not provide an executable client or modify `boto3`'s runtime behavior. It only provides type hints for static analysis.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use explicit type hints for `boto3.client()` and `boto3.resource()` return values, as shown in the quickstart (e.g., `client: CleanRoomsMLClient = boto3.client('cleanrooms-ml')`).","message":"Some IDEs (e.g., VS Code without specific extensions or configurations) may require explicit type annotations for `boto3.client()` and `boto3.resource()` calls to fully leverage the type stubs for autocomplete and inline error detection.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}