mypy-boto3-snow-device-management
This library provides type annotations (stubs) for the `boto3` AWS Snow Device Management service, generated by `mypy-boto3-builder`. It enhances type checking for `boto3` code with tools like `mypy`, preventing common runtime errors related to incorrect AWS API calls. The current version is 1.42.3, with releases closely following `boto3` updates and the `mypy-boto3-builder`'s frequent development cycle.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0 (and thus packages built with it), Python 3.8 is no longer supported. All generated `mypy-boto3-*` packages will now require Python 3.9 or higher.
- breaking As of `mypy-boto3-builder` version 8.9.0, there were changes to TypeDef naming conventions. Specifically, some generated type definition names were shortened (e.g., `*RequestRequestTypeDef` became `*RequestTypeDef`). If you directly imported specific TypeDefs, you may need to update their names.
- gotcha This package provides *only* type annotations for `boto3`. It does not include any runtime functionality itself. You must have `boto3` installed separately for your code to execute, and a type checker like `mypy` to leverage the benefits of these stubs.
- gotcha The versions of service-specific `mypy-boto3-*` packages are tied to the `boto3` version they stub and the `mypy-boto3-builder`'s release cycle. Breaking changes or new features in the underlying `boto3` or `mypy-boto3-builder` can impact these stub packages, sometimes leading to more frequent updates or specific version requirements.
Install
-
pip install mypy-boto3-snow-device-management boto3 mypy
Imports
- SnowDeviceManagementClient
from mypy_boto3_snow_device_management.client import SnowDeviceManagementClient
- DescribeDeviceOutputTypeDef
from mypy_boto3_snow_device_management.type_defs import DescribeDeviceOutputTypeDef
Quickstart
import boto3
from mypy_boto3_snow_device_management.client import SnowDeviceManagementClient
from mypy_boto3_snow_device_management.type_defs import DescribeDeviceOutputTypeDef
import os
# Create a boto3 client (runtime object)
# Mypy will now correctly type-check operations on 'client'
client: SnowDeviceManagementClient = boto3.client("snow-device-management")
# Example usage with type hints
device_id = os.environ.get('AWS_SNOW_DEVICE_ID', 'your-device-id-placeholder')
if device_id == 'your-device-id-placeholder':
print("Please set the AWS_SNOW_DEVICE_ID environment variable for a real test.")
print("Using a placeholder, type checking will still work.")
try:
response: DescribeDeviceOutputTypeDef = client.describe_device(deviceId=device_id)
print(f"Device ARN: {response.get('deviceArn')}")
print(f"Device type: {response.get('deviceType')}")
# Mypy would warn if 'deviceArn' was not a valid key in DescribeDeviceOutputTypeDef
except client.exceptions.ResourceNotFoundException:
print(f"Device with ID '{device_id}' not found.")
except Exception as e:
print(f"An error occurred: {e}")