Registry / type-stubs / mypy-boto3-kms

mypy-boto3-kms

JSON →
library1.43.12pypypi✓ verified 23d ago

mypy-boto3-kms provides static type annotations for the AWS Key Management Service (KMS) client in `boto3`, enhancing type safety and developer experience with tools like MyPy. It is part of the `mypy-boto3` collection, automatically generated by `mypy-boto3-builder`, and its current version (1.42.50) is synchronized with the underlying `boto3` service definition versions. The project maintains a regular release cadence, often updating with new `boto3` versions and `mypy-boto3-builder` enhancements.

pip install boto3 mypy-boto3-kms
INSTALL
IMPORT
SIG · MYPY-BOTO3-KMS
M
mypy-boto3-kms
type-stubspythonv1.43.12
Install
4.0s avg
Import
611ms
Disk
50MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.43.12 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.628s · 52.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.0s · import 0.594s · 53MB
50MB installed
● package 50MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

KMSClient
from mypy_boto3_kms.client import KMSClient
CreateKeyRequestRequestTypeDef
from mypy_boto3_kms.type_defs import CreateKeyRequestRequestTypeDef
from mypy_boto3_kms.type_defs import CreateKeyRequestTypeDef
Pre-8.9.0 builder versions might have used shorter or different TypeDef names. Always check the generated stub files if unsure.
ListKeysResponseTypeDef
from mypy_boto3_kms.type_defs import ListKeysResponseTypeDef

Demonstrates how to import and use the KMSClient type for `boto3` client type-hinting, and how to use generated TypeDefs for request/response payloads to leverage static analysis with MyPy. Remember to install `boto3` alongside `mypy-boto3-kms`.

import boto3 from mypy_boto3_kms.client import KMSClient from mypy_boto3_kms.type_defs import ListKeysResponseTypeDef, CreateKeyRequestRequestTypeDef # Initialize a KMS client, type-hinted for static analysis kms_client: KMSClient = boto3.client("kms") # Example operation: List KMS keys try: # mypy will verify the return type matches ListKeysResponseTypeDef response: ListKeysResponseTypeDef = kms_client.list_keys() print("KMS Keys:") for key in response.get("Keys", []): print(f" Key ID: {key.get('KeyId')}, Key ARN: {key.get('KeyArn')}") except Exception as e: print(f"Error listing keys: {e}") # Example of using a TypeDef for a request payload (for type-checking) create_key_params: CreateKeyRequestRequestTypeDef = { "Description": "My Test Key", "KeyUsage": "ENCRYPT_DECRYPT", "KeySpec": "SYMMETRIC_DEFAULT", "Tags": [ {"TagKey": "Project", "TagValue": "MyProject"} ] } # mypy would check 'create_key_params' against 'CreateKeyRequestRequestTypeDef' print(f"\nExample CreateKeyRequest parameters (for type-checking): {create_key_params}") # To run mypy against this file: # mypy your_script_name.py
Debug
Known issues
breakingAs of `mypy-boto3-builder` version 8.12.0, Python 3.8 support has been removed across all generated `mypy-boto3` packages. You must use Python 3.9 or newer.
fix
Upgrade your Python environment to 3.9 or later.
affects: mypy-boto3-builder >=8.12.0, mypy-boto3-kms >=1.42.x
breakingTypeDef naming conventions were significantly changed in `mypy-boto3-builder` 8.9.0. TypeDefs for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting 'Extra' postfixes moved to the end. Code relying on specific TypeDef names may break.
fix
Consult the `mypy-boto3-builder` changelog and update TypeDef names in your code. Auto-completion in IDEs usually helps find the correct new names.
affects: mypy-boto3-builder >=8.9.0, mypy-boto3-kms >=1.40.x
gotcha`mypy-boto3-kms` provides only type stubs. For your application to run, `boto3` must be installed and properly configured (e.g., AWS credentials) in your environment. These stubs do not provide any runtime functionality.
fix
Ensure `pip install boto3` is part of your project's dependencies and that your AWS credentials are set up correctly.
affects: all
gotchaThe version of `mypy-boto3-kms` should ideally align with the `boto3` version you are using or the `boto3` service definition it was generated against. Mismatches can lead to incorrect type hints for newer or older API features.
fix
Periodically update both `boto3` and `mypy-boto3-kms` to their latest compatible versions. The `mypy-boto3` project generally keeps stub versions in sync with the `boto3` service definition versions.
affects: all
gotchaThe `mypy-boto3` packages migrated to PEP 561 compatible package structure in `mypy-boto3-builder` 8.12.0. If you have custom `mypy` configurations that rely on specific internal paths or non-PEP 561 layouts, you may need to update them.
fix
Review your `mypy` configuration (`mypy.ini`, `pyproject.toml`) and ensure it adheres to standard PEP 561 package discovery mechanisms. For most users, this change is transparent.
affects: mypy-boto3-builder >=8.12.0, mypy-boto3-kms >=1.42.x
Upgrade
Version history
1.43.12latest on PyPI · released May 20, 2026
Audit
Dependencies
boto3requiredThese are type stubs for boto3's KMS client. boto3 itself is required for runtime functionality.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
mypy-boto3-kms — pip install mypy-boto3-kms · libregistry