Install & Compatibility
Where this runs
tested against v1.43.0 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.582s · 51.9MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.546s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CloudHSMClient
✓ from mypy_boto3_cloudhsm import CloudHSMClient
ListHsmsResponseTypeDef
✓ from mypy_boto3_cloudhsm.type_defs import ListHsmsResponseTypeDef
This quickstart demonstrates how to use `mypy-boto3-cloudhsm` for type hinting with a `boto3` CloudHSM client. The `TYPE_CHECKING` block ensures that type-hint-specific imports and assignments are only evaluated by type checkers and not at runtime, avoiding unnecessary dependencies in production. Remember to install `boto3` alongside `mypy-boto3-cloudhsm`.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_cloudhsm import CloudHSMClient
from mypy_boto3_cloudhsm.type_defs import ListHsmsResponseTypeDef
# Initialize a boto3 client (runtime code)
client = boto3.client("cloudhsm")
# Type hint the client for static analysis
if TYPE_CHECKING:
typed_client: CloudHSMClient = client
response: ListHsmsResponseTypeDef = typed_client.list_hsms()
# Example of using the client (runtime code)
# For a real application, consider error handling and pagination
list_hsms_response = client.list_hsms()
print(f"CloudHSM HSMs: {list_hsms_response.get('Hsms', [])}")
Debug
Known issues
breakingPython 3.8 support has been removed. All `mypy-boto3-*` packages, including `mypy-boto3-cloudhsm`, now require Python 3.9 or higher due to changes in `mypy-boto3-builder` version 8.12.0.fixUpgrade your Python environment to 3.9 or newer.
affects: mypy-boto3-builder >= 8.12.0 (generating mypy-boto3-cloudhsm versions 1.42.0+)
breakingPackages generated by `mypy-boto3-builder` (version 8.12.0 and above) now follow PEP 561 for distributing type information. This change might affect how type checkers discover and apply stubs in certain environments or older project configurations.fixEnsure your type checker (e.g., MyPy, Pylance) and project setup are compatible with PEP 561 packaging standards. Re-evaluate your type checker configuration if issues arise.
affects: mypy-boto3-builder >= 8.12.0 (generating mypy-boto3-cloudhsm versions 1.42.0+)
gotchaThis library provides *only* type annotations for the AWS CloudHSM service. You must install the `boto3` library separately for actual runtime functionality and API calls. `mypy-boto3-cloudhsm` is not a standalone AWS SDK.fixAlways install `boto3` in addition to `mypy-boto3-cloudhsm` (e.g., `pip install boto3 mypy-boto3-cloudhsm`).
affects: All versions
gotchaFor optimal type checking accuracy, it is recommended to keep the `mypy-boto3-cloudhsm` version aligned with the major and minor version of your `boto3` installation. The stubs are generated based on specific AWS API versions, and mismatches can lead to incomplete or incorrect type hints.fixRegularly update both `boto3` and `mypy-boto3-cloudhsm`. If you pin `boto3` to a specific version, consider generating stubs locally using `mypy-boto3-builder` to match that version precisely.
affects: All versions
breakingBreaking changes to TypeDef naming conventions (e.g., shorter names for packed method arguments, conflict resolution) were introduced in `mypy-boto3-builder` version 8.9.0. While described generally for 'services', these changes can affect any service's generated TypeDefs, including CloudHSM.fixReview your code for any direct imports or references to `TypeDef` names that may have changed. Consult the specific service documentation generated by `mypy-boto3-builder` if issues occur.
affects: mypy-boto3-builder >= 8.9.0 (generating mypy-boto3-cloudhsm versions ~1.39.0+)
Upgrade
Version history
1.43.0latest on PyPI · released Apr 29, 2026
Audit
Dependencies
boto3requiredmypy-boto3-cloudhsm provides type stubs for boto3; boto3 is required for actual runtime functionality.
typing-extensionsoptionalMay be required for older Python versions, though primary support is now Python 3.9+.