Type annotations for boto3 HealthImaging
mypy-boto3-medical-imaging provides type annotations for the `boto3` HealthImaging (Medical Imaging) service. It allows static type checkers like MyPy to validate usage of `boto3` clients, resources, and session methods, enhancing code quality and developer experience. The current version is 1.42.81, and new versions are released frequently, typically mirroring `boto3` releases or `mypy-boto3-builder` updates.
Warnings
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. This means `mypy-boto3-medical-imaging` versions built with 8.12.0 or newer (like 1.42.81) no longer support Python 3.8.
- breaking As of `mypy-boto3-builder` version 8.12.0, all generated `mypy-boto3-*` packages, including `mypy-boto3-medical-imaging`, migrated to PEP 561 compliance. This changes the internal package structure, which could potentially affect tools or custom `mypy` configurations that relied on the previous layout.
- gotcha The `boto3` service name for Medical Imaging is 'health-imaging', not 'medical-imaging'. Attempting to use `boto3.client("medical-imaging")` will result in a `UnknownServiceError` at runtime.
- gotcha The `mypy-boto3-*` stubs are generated for specific `boto3` versions. Using significantly mismatched versions (e.g., a very old `boto3` with the latest stubs, or vice-versa) can lead to incorrect type-checking warnings or errors, as the API signatures may have changed.
Install
-
pip install mypy-boto3-medical-imaging
Imports
- HealthImagingClient
from mypy_boto3_medical_imaging.client import HealthImagingClient
- CreateImageSetOutputTypeDef
from mypy_boto3_medical_imaging.type_defs import CreateImageSetOutputTypeDef
Quickstart
import boto3
from mypy_boto3_medical_imaging.client import HealthImagingClient
from mypy_boto3_medical_imaging.type_defs import ListImageSetsOutputTypeDef
# Ensure you have boto3 installed and configured for AWS access
# Example for a typed HealthImaging client
client: HealthImagingClient = boto3.client("health-imaging")
try:
# List image sets in a data store
response: ListImageSetsOutputTypeDef = client.list_image_sets(datastoreId="YOUR_DATASTORE_ID")
print(f"Successfully listed {len(response.get('imageSets', []))} image sets.")
if response.get('imageSets'):
print(f"First image set ID: {response['imageSets'][0]['imageSetId']}")
except client.exceptions.ResourceNotFoundException:
print("Data store not found. Please provide a valid datastoreId.")
except Exception as e:
print(f"An error occurred: {e}")