{"id":3061,"library":"mypy-boto3-comprehendmedical","title":"Type Annotations for boto3 ComprehendMedical","description":"mypy-boto3-comprehendmedical provides comprehensive type annotations (stubs) for the boto3 ComprehendMedical client. Generated by `mypy-boto3-builder`, this package enhances development with static type checking, improved IDE auto-completion, and early error detection for your AWS ComprehendMedical interactions. It closely tracks `boto3` releases, with the current version being 1.42.3, compatible with boto3 1.42.3 and generated by builder 8.12.0.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","mypy","type-hints","comprehendmedical","stubs","static-analysis"],"install":[{"cmd":"pip install mypy-boto3-comprehendmedical boto3 mypy","lang":"bash","label":"Install with boto3 and mypy"}],"dependencies":[{"reason":"Provides the underlying AWS SDK runtime functionality that these stubs annotate.","package":"boto3","optional":false},{"reason":"Required for static type checking of Python code using these stubs.","package":"mypy","optional":false},{"reason":"Minimum Python version required by the package.","package":"python","optional":false}],"imports":[{"note":"Directly importing from boto3 will not provide the enhanced type hints for the client object.","wrong":"from boto3.client import ComprehendMedicalClient","symbol":"ComprehendMedicalClient","correct":"from mypy_boto3_comprehendmedical.client import ComprehendMedicalClient"},{"note":"Type definition imports come from the stub package, not directly from boto3 or botocore.","wrong":"from boto3.comprehendmedical.type_defs import DetectEntitiesV2ResponseTypeDef","symbol":"DetectEntitiesV2ResponseTypeDef","correct":"from mypy_boto3_comprehendmedical.type_defs import DetectEntitiesV2ResponseTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\nfrom mypy_boto3_comprehendmedical.client import ComprehendMedicalClient\nfrom mypy_boto3_comprehendmedical.type_defs import DetectEntitiesV2ResponseTypeDef\n\nif TYPE_CHECKING:\n    client: ComprehendMedicalClient = boto3.client(\"comprehendmedical\")\nelse:\n    client = boto3.client(\"comprehendmedical\")\n\n# Example usage with type-hinted client\ndef process_medical_text(text: str) -> DetectEntitiesV2ResponseTypeDef:\n    try:\n        response: DetectEntitiesV2ResponseTypeDef = client.detect_entities_v2(\n            Text=text\n        )\n        print(f\"Detected entities: {len(response['Entities'])}\")\n        return response\n    except client.exceptions.ClientError as e:\n        print(f\"Error processing text: {e}\")\n        raise\n\n# Example call\nmedical_note = \"Patient has a history of type 2 diabetes and hypertension.\"\nif __name__ == \"__main__\":\n    # In a real application, you'd handle AWS credentials/region configuration\n    # or use boto3's default credential chain.\n    # For this example, ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)\n    try:\n        result = process_medical_text(medical_note)\n        # Further processing of result, e.g., result['Entities'][0]['Text']\n    except Exception as e:\n        print(f\"An error occurred during quickstart: {e}\")\n","lang":"python","description":"This quickstart demonstrates how to initialize a type-hinted ComprehendMedical client and use one of its methods, `detect_entities_v2`. It uses `TYPE_CHECKING` for conditional imports, ensuring the stubs are only active during type checking."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or newer. If you must use Python 3.8, pin your `mypy-boto3-comprehendmedical` version to an older compatible release.","message":"Python 3.8 support was removed for `mypy-boto3-builder` version 8.12.0 and later, which generated this package version. Consequently, `mypy-boto3-comprehendmedical` 1.42.3 and newer versions require Python 3.9 or higher.","severity":"breaking","affected_versions":"1.42.3+"},{"fix":"Ensure `mypy` is up-to-date and that stub packages are installed in the same Python environment used by `mypy`. Avoid relying on `MYPYPATH` for stub-only packages; they should be installed via `pip`.","message":"The `mypy-boto3-builder` (version 8.12.0+) migrated to PEP 561 compliant packages. This change might affect how some tools or older `mypy` versions discover and use the stubs if your `mypy` configuration is not up-to-date or if you relied on older stub discovery mechanisms (e.g., specific `MYPYPATH` configurations for non-installed stubs).","severity":"breaking","affected_versions":"1.42.3+"},{"fix":"Always install `boto3` alongside `mypy-boto3-comprehendmedical` (e.g., `pip install boto3 mypy-boto3-comprehendmedical`).","message":"This package provides type stubs, not the actual runtime implementation of `boto3`. You must install `boto3` separately for your code to function at runtime.","severity":"gotcha","affected_versions":"All"},{"fix":"Integrate `mypy` into your CI/CD pipeline or use it during development (`mypy your_project/`). Ensure your IDE is configured to use type checking (e.g., Pylance in VSCode, Mypy plugin in PyCharm).","message":"The type hints provided by this library are only utilized by static type checkers (like `mypy`) and IDEs (like VSCode, PyCharm) for analysis and auto-completion. They do not enforce types at runtime.","severity":"gotcha","affected_versions":"All"},{"fix":"Regularly update both `boto3` and its corresponding `mypy-boto3-comprehendmedical` stub package. Consider pinning versions in your `requirements.txt` (e.g., `boto3==1.42.3`, `mypy-boto3-comprehendmedical==1.42.3`).","message":"For accurate type checking, the version of `mypy-boto3-comprehendmedical` should ideally match the version of `boto3` you are using. Mismatched versions can lead to incorrect type hints or missing attributes if `boto3` introduces changes not yet reflected in the stubs.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}