{"id":3045,"library":"mypy-boto3-cloudhsm","title":"mypy-boto3-cloudhsm Type Annotations for AWS CloudHSM","description":"mypy-boto3-cloudhsm provides type annotations for the AWS CloudHSM service, designed to be used with `boto3`. It enhances development experience by enabling static type checking with tools like MyPy, Pylance, and IDEs like VSCode and PyCharm. The package is part of the `mypy-boto3-builder` ecosystem, which generates stubs for all `boto3` services, often releasing updates aligned with `boto3` and botocore releases.","status":"active","version":"1.42.3","language":"python","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","cloudhsm","stubs","type-checking"],"install":[{"cmd":"pip install boto3 mypy-boto3-cloudhsm","lang":"bash","label":"Install with pip"}],"dependencies":[{"reason":"mypy-boto3-cloudhsm provides type stubs for boto3; boto3 is required for actual runtime functionality.","package":"boto3","optional":false},{"reason":"May be required for older Python versions, though primary support is now Python 3.9+.","package":"typing-extensions","optional":true}],"imports":[{"symbol":"CloudHSMClient","correct":"from mypy_boto3_cloudhsm import CloudHSMClient"},{"symbol":"ListHsmsResponseTypeDef","correct":"from mypy_boto3_cloudhsm.type_defs import ListHsmsResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from mypy_boto3_cloudhsm import CloudHSMClient\n    from mypy_boto3_cloudhsm.type_defs import ListHsmsResponseTypeDef\n\n# Initialize a boto3 client (runtime code)\nclient = boto3.client(\"cloudhsm\")\n\n# Type hint the client for static analysis\nif TYPE_CHECKING:\n    typed_client: CloudHSMClient = client\n    response: ListHsmsResponseTypeDef = typed_client.list_hsms()\n\n# Example of using the client (runtime code)\n# For a real application, consider error handling and pagination\nlist_hsms_response = client.list_hsms()\nprint(f\"CloudHSM HSMs: {list_hsms_response.get('Hsms', [])}\")\n","lang":"python","description":"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`."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer.","message":"Python 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.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (generating mypy-boto3-cloudhsm versions 1.42.0+)"},{"fix":"Ensure 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.","message":"Packages 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.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.12.0 (generating mypy-boto3-cloudhsm versions 1.42.0+)"},{"fix":"Always install `boto3` in addition to `mypy-boto3-cloudhsm` (e.g., `pip install boto3 mypy-boto3-cloudhsm`).","message":"This 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Regularly 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.","message":"For 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.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review 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.","message":"Breaking 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.","severity":"breaking","affected_versions":"mypy-boto3-builder >= 8.9.0 (generating mypy-boto3-cloudhsm versions ~1.39.0+)"}],"env_vars":null,"search_vec":"'align':69 'annot':6,16 'aw':8,19,75 'boto3':3,12,27,56,64,71,76 'botocor':73 'builder':57 'check':36,85 'cloudhsm':4,9,13,20,81 'design':22 'develop':30 'ecosystem':58 'enabl':33 'enhanc':29 'experi':31 'generat':60 'hint':80 'ide':43 'like':39,44 'mypi':2,11,40,55,77 'mypy-boto3-builder':54 'mypy-boto3-cloudhsm':1,10 'often':66 'packag':49 'part':51 'provid':14 'pycharm':47 'pylanc':41 'releas':67,74 'servic':21,65 'static':34 'stub':61,82 'tool':38 'type':5,15,35,79,84 'type-check':83 'type-hint':78 'updat':68 'use':25 'vscode':45","created_at":"2026-04-11T09:18:42.028318+00:00","updated_at":"2026-04-16T16:49:47.976858+00:00","problems":{"verify_error":"error: Failed to parse: `boto3 mypy-boto3-cloudhsm`\n  Caused by: Expected one of `@`, `(`, `<`, `=`, `>`, `~`, `!`, `;`, found `m`\nboto3 mypy-boto3-cloudhsm\n      ^"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"1.43.0","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/youtype/mypy_boto3_builder","docs":"https://youtype.github.io/boto3_stubs_docs/mypy_boto3_cloudhsm/","changelog":null,"pypi":"https://pypi.org/project/mypy-boto3-cloudhsm/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["type-stubs","aws"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-05","install_tag":null}}