{"id":4293,"library":"types-aiobotocore-kms","title":"Type annotations for aiobotocore KMS","description":"Type annotations for `aiobotocore KMS` service, compatible with various type checkers and IDEs like VSCode, PyCharm, and mypy. Generated by `mypy-boto3-builder`, it currently provides stubs for `aiobotocore 3.4.0` and is generated with `mypy-boto3-builder 8.12.0`. Releases are frequent, typically mirroring `mypy-boto3-builder` and underlying `aiobotocore` updates.","status":"active","version":"3.4.0","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","aiobotocore","kms","types","mypy","stubs","async","type-hints"],"install":[{"cmd":"pip install types-aiobotocore-kms","lang":"bash","label":"Install standalone package"},{"cmd":"pip install 'types-aiobotocore[kms]'","lang":"bash","label":"Install as part of main types-aiobotocore"}],"dependencies":[{"reason":"Provides the underlying asynchronous AWS client library for which these are type stubs.","package":"aiobotocore","optional":true},{"reason":"Requires Python 3.9 or newer.","package":"Python","optional":false}],"imports":[{"symbol":"KMSClient","correct":"from types_aiobotocore_kms.client import KMSClient"},{"symbol":"get_session","correct":"from aiobotocore.session import get_session"}],"quickstart":{"code":"import asyncio\nimport os\n\nfrom aiobotocore.session import get_session\nfrom types_aiobotocore_kms.client import KMSClient\n\nasync def describe_key_example():\n    session = get_session()\n    async with session.create_client(\n        \"kms\",\n        region_name=os.environ.get('AWS_REGION', 'us-east-1'),\n        aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', 'test'),\n        aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', 'test'),\n        aws_session_token=os.environ.get('AWS_SESSION_TOKEN', None),\n    ) as client:  # type: KMSClient\n        # Replace with a valid KMS Key ID or ARN for real usage\n        key_id = \"arn:aws:kms:us-east-1:123456789012:key/your-key-id\" # Placeholder\n        try:\n            response = await client.describe_key(KeyId=key_id)\n            print(f\"Key description: {response.get('KeyMetadata', {})}\")\n        except Exception as e:\n            print(f\"Error describing key {key_id}: {e}\")\n\nif __name__ == \"__main__\":\n    # Ensure AWS credentials and region are set in environment variables\n    # or configure aiobotocore session appropriately.\n    # For this example, placeholders are used, but for real AWS interaction,\n    # valid credentials and a valid KeyId are required.\n    asyncio.run(describe_key_example())\n","lang":"python","description":"This example demonstrates how to use the `KMSClient` from `types-aiobotocore-kms` with `aiobotocore` to describe a KMS key, leveraging type hints for better code completion and error checking. It includes basic setup for an asynchronous client session."},"warnings":[{"fix":"Upgrade Python to 3.9 or newer. If stuck on Python 3.8, pin `types-aiobotocore-kms` to an older version compatible with `mypy-boto3-builder < 8.12.0`.","message":"Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0, which affects `types-aiobotocore-kms`. Projects requiring Python 3.8 must use an older version of the stubs or upgrade their Python interpreter.","severity":"breaking","affected_versions":">=8.12.0 of mypy-boto3-builder (used to generate types-aiobotocore-kms)"},{"fix":"Update `TypeDef` references in your code to match the new naming conventions.","message":"In `mypy-boto3-builder` version 8.9.0, `TypeDef` naming conventions changed. Argument `TypeDefs` use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes moved (e.g., `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`). This is a breaking change for code explicitly referencing these `TypeDef` names.","severity":"breaking","affected_versions":">=8.9.0 of mypy-boto3-builder"},{"fix":"Ensure that the installed `types-aiobotocore-kms` package version is compatible with your `aiobotocore` runtime version. Ideally, keep them in sync.","message":"The `types-aiobotocore-kms` package version is tied to the `aiobotocore` version it provides stubs for. Mismatches between the installed stub package and the runtime `aiobotocore` version can lead to type checking errors or missing types, as method signatures or available operations might differ.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider installing `types-aiobotocore-lite[kms]` instead of `types-aiobotocore-kms` (or `types-aiobotocore[kms]`) to alleviate performance issues in PyCharm, or disable PyCharm's internal type checker and use `mypy` or `pyright`.","message":"Due to known performance issues in PyCharm with `Literal` overloads (issue PY-40997), it is recommended to use `types-aiobotocore-lite` for better IDE performance if you experience slowness or high CPU usage with PyCharm's type checker.","severity":"gotcha","affected_versions":"All versions, specifically when used with PyCharm"},{"fix":"Verify that your type checker (e.g., mypy, pyright) correctly discovers the stubs after upgrading. Adjust `mypy_path` or `pyrightconfig.json` if necessary.","message":"As of `mypy-boto3-builder` 8.12.0, all packages migrated to PEP 561. This generally improves type checker compatibility but might require re-evaluation of import paths or stub discovery configurations in complex or highly customized type-checking setups.","severity":"gotcha","affected_versions":">=8.12.0 of mypy-boto3-builder"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}