{"id":3125,"library":"mypy-boto3-ram","title":"Type annotations for boto3 RAM service","description":"mypy-boto3-ram provides type annotations for the AWS Resource Access Manager (RAM) service for boto3, ensuring type-checking and autocompletion in IDEs. It is currently at version 1.42.59, and is part of the actively maintained `mypy-boto3` family, which frequently updates to match new `boto3` versions and includes features from `mypy-boto3-builder`.","status":"active","version":"1.42.59","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","typing","ram","resource-access-manager"],"install":[{"cmd":"pip install mypy-boto3-ram","lang":"bash","label":"Install standalone package"},{"cmd":"pip install 'boto3-stubs[ram]'","lang":"bash","label":"Install as part of boto3-stubs (recommended for full functionality)"}],"dependencies":[{"reason":"mypy-boto3-ram provides type stubs for boto3, which must be installed separately for runtime functionality.","package":"boto3"}],"imports":[{"note":"Type definitions for AWS service clients are provided by mypy-boto3-ram, not directly from boto3 or botocore.","wrong":"from boto3.client import RAMClient","symbol":"RAMClient","correct":"from mypy_boto3_ram import RAMClient"}],"quickstart":{"code":"import boto3\nfrom mypy_boto3_ram import RAMClient\nimport os\n\ndef list_resource_shares_typed() -> None:\n    # It's recommended to explicitly type the client for full type-checking benefits\n    # Especially if not installing the full 'boto3-stubs' package\n    client: RAMClient = boto3.client(\"ram\", region_name=os.environ.get('AWS_REGION', 'us-east-1'))\n\n    # The client methods are now fully type-checked\n    response = client.list_resource_shares(resourceOwner='SELF')\n    \n    print(\"Resource Shares:\")\n    for share in response.get('resourceShares', []):\n        print(f\"  - {share['name']} ({share['status']})\")\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials/config are set up, e.g., via environment variables or ~/.aws/credentials\n    # For this example, we're using a dummy region name; replace with actual if needed.\n    list_resource_shares_typed()","lang":"python","description":"This example demonstrates how to initialize a `RAMClient` with type annotations and use a basic operation like `list_resource_shares`. The type annotation ensures that `mypy` and IDEs provide correct autocompletion and type-checking for RAM service-specific methods and parameters."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Python 3.8 support has been removed in mypy-boto3-builder version 8.12.0 and later packages. Users on Python 3.8 will need to upgrade to Python 3.9+ or use an older version of mypy-boto3-ram.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0, mypy-boto3-ram >= 1.42.x"},{"fix":"Review and update explicit `TypeDef` imports in your codebase according to the new naming conventions. Refer to the specific service's documentation for updated TypeDef names.","message":"TypeDef names were changed in mypy-boto3-builder 8.9.0. This includes shortening packed method argument TypeDefs (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`) and moving `Extra` postfixes for conflicting names. Code relying on explicit TypeDef imports might break.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0"},{"fix":"Ensure that your `boto3` and `mypy-boto3-ram` package versions are aligned. For instance, install `boto3==1.42.59` alongside `mypy-boto3-ram==1.42.59`.","message":"Mismatching versions of `boto3` and `mypy-boto3-ram` can lead to incorrect type hints or `mypy` errors. `mypy-boto3-ram` versions generally correspond to compatible `boto3` versions (e.g., `mypy-boto3-ram 1.42.59` is for `boto3 1.42.59`).","severity":"gotcha","affected_versions":"All versions"},{"fix":"For the best experience with auto-discovery of types and IDE completion, consider installing `boto3-stubs` with the `ram` extra: `pip install 'boto3-stubs[ram]'`.","message":"While `mypy-boto3-ram` is a standalone package, for comprehensive `boto3` type-hinting, especially for `Session.client()` and `Session.resource()` overloads without explicit annotations, installing `boto3-stubs[ram]` is often recommended. Standalone packages might require more explicit type annotations in some IDEs.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To resolve Pylint complaints, set the type aliases to `object` in the `else` branch of the `TYPE_CHECKING` block. For example:\n`if TYPE_CHECKING: from mypy_boto3_ram import RAMClient\nelse: RAMClient = object`","message":"Pylint might report 'undefined variable' errors when using `from typing import TYPE_CHECKING` blocks to conditionally import `mypy-boto3` types. This is a known issue with Pylint's interaction with `TYPE_CHECKING`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"If experiencing PyCharm performance issues, consider uninstalling `mypy-boto3-ram` (or `boto3-stubs`) and installing the lite version: `pip install 'boto3-stubs-lite[ram]'`. Note that the lite version requires more explicit type annotations.","message":"PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads in `boto3-stubs` packages. The `lite` versions of the stubs are provided as a workaround.","severity":"gotcha","affected_versions":"All versions (specific to PyCharm)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}