{"id":3653,"library":"mypy-boto3-oam","title":"Type annotations for boto3 CloudWatchObservabilityAccessManager","description":"mypy-boto3-oam provides type annotations for the boto3 CloudWatchObservabilityAccessManager service, enabling static type checking and improved IDE support for AWS SDK for Python (boto3) users. It is generated with `mypy-boto3-builder 8.12.0` and currently stands at version 1.42.3, aligning with the versioning of `boto3` for which it provides stubs. The `mypy-boto3` project actively releases updates, often in sync with `boto3` and `botocore` releases, as well as `mypy-boto3-builder` 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","stubs","cloudwatch","observability","oam"],"install":[{"cmd":"pip install mypy-boto3-oam boto3","lang":"bash","label":"Install with boto3"}],"dependencies":[{"reason":"Runtime dependency for the AWS SDK for Python; this package provides type stubs for it.","package":"boto3"},{"reason":"Primary static type checker for which these stubs are designed.","package":"mypy","optional":true},{"reason":"Alternative static type checker that also leverages these stubs.","package":"pyright","optional":true}],"imports":[{"note":"Type stubs are imported from the mypy_boto3_oam package, not directly from boto3's internal structure.","wrong":"from boto3.oam.client import CloudWatchObservabilityAccessManagerClient","symbol":"CloudWatchObservabilityAccessManagerClient","correct":"from mypy_boto3_oam.client import CloudWatchObservabilityAccessManagerClient"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_oam.client import CloudWatchObservabilityAccessManagerClient\n\ndef get_oam_client() -> 'CloudWatchObservabilityAccessManagerClient':\n    \"\"\"Gets a type-hinted CloudWatch Observability Access Manager client.\"\"\"\n    # In a real application, credentials would be managed by boto3's configuration\n    # or environment variables.\n    client: CloudWatchObservabilityAccessManagerClient = boto3.client(\n        \"oam\",\n        region_name=\"us-east-1\",\n        aws_access_key_id=\"{}\".format(os.environ.get('AWS_ACCESS_KEY_ID', '')) if os.environ.get('AWS_ACCESS_KEY_ID') else None,\n        aws_secret_access_key=\"{}\".format(os.environ.get('AWS_SECRET_ACCESS_KEY', '')) if os.environ.get('AWS_SECRET_ACCESS_KEY') else None\n    )\n    return client\n\n# Example usage (will not actually call AWS without valid credentials)\noam_client = get_oam_client()\nprint(f\"Client type: {type(oam_client)}\")\n# mypy will now correctly infer methods like oam_client.list_attachments()\n# without requiring a runtime call.\n","lang":"python","description":"This quickstart demonstrates how to obtain a type-hinted `CloudWatchObservabilityAccessManagerClient` using `boto3` and `mypy-boto3-oam`. It includes a `TYPE_CHECKING` guard for conditional imports, which is a common practice to avoid runtime dependencies on stub packages. Replace placeholder credentials or ensure your environment is configured for AWS authentication."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or a newer version (e.g., `python -m pip install --upgrade pip` then `pyenv install 3.9.18` and switch if using pyenv).","message":"Support for Python 3.8 has been removed across all `mypy-boto3` packages, including `mypy-boto3-oam`. Users on Python 3.8 will need to upgrade to Python 3.9 or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder 8.12.0 and above"},{"fix":"Review your code for direct imports or explicit usage of `mypy_boto3_oam.type_defs` to ensure TypeDef names align with the latest generated stubs. IDEs with `mypy` or `pyright` should help identify these.","message":"The `mypy-boto3-builder` (which generates this stub) introduced changes to TypeDef naming conventions in version 8.9.0. Specifically, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `Extra` postfixes moved (`CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). While this package's core Client type is stable, explicit references to generated TypeDefs might require updates if you're using older code with newer stubs.","severity":"breaking","affected_versions":"mypy-boto3-builder 8.9.0 and above (affecting generated stub contents)"},{"fix":"Update your type checker (e.g., `pip install --upgrade mypy`) and ensure your IDE's Python language server (e.g., Pylance for VSCode) is also up to date and correctly configured to use `mypy` or `pyright`.","message":"`mypy-boto3` migrated to PEP 561 packages, which is the standard for distributing type information. While this improves compatibility, users of older `mypy` or `IDE` versions might experience issues recognizing type stubs. Ensure your type checking tools are up-to-date.","severity":"gotcha","affected_versions":"mypy-boto3-builder 8.12.0 and above"},{"fix":"Explicitly type hint your `boto3.client()` calls, e.g., `client: CloudWatchObservabilityAccessManagerClient = boto3.client('oam')`.","message":"For optimal IDE auto-completion and type inference (especially in VSCode and PyCharm), it is often recommended to use explicit type annotations when instantiating `boto3` clients, even though `mypy-boto3` aims for automatic type discovery. This can prevent cases where the IDE struggles to infer the correct `boto3` client type.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To fix this, you can configure Pylint to ignore these specific errors (e.g., `disable=no-name-in-module,ungot-typeinfo` in your `.pylintrc`) or use `# type: ignore` comments judiciously.","message":"When using `mypy-boto3-oam` with Pylint, if you conditionally import type stubs using `if TYPE_CHECKING: ... else: ...`, Pylint might report `undefined variable` errors for the runtime `object` assignments. This is a known issue with Pylint's interaction with `TYPE_CHECKING` guards.","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"}