mypy-boto3-iot-jobs-data Type Annotations

1.42.3 · active · verified Sat Apr 11

mypy-boto3-iot-jobs-data provides type annotations for the `boto3` IoTJobsDataPlane service. It aims to enhance development experience by enabling static type checking with tools like MyPy, PyRight, and improved autocomplete in IDEs such as VSCode and PyCharm. The library is actively maintained, with frequent updates tied to new releases of `mypy-boto3-builder`, ensuring compatibility with the latest `boto3` versions. [3, 4, 7]

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize an IoTJobsDataPlane client with type annotations and use it to call a service method. The `TYPE_CHECKING` block is standard practice to ensure type imports are only active during static analysis, avoiding runtime dependencies on the stub package. Explicit type annotations for the client and response dictionaries provide maximum benefit for type checking and IDE features. [5, 8, 12, 16]

import boto3
from typing import TYPE_CHECKING
from mypy_boto3_iot_jobs_data.client import IoTJobsDataPlaneClient
from mypy_boto3_iot_jobs_data.type_defs import DescribeJobExecutionResponseTypeDef

# Boto3 client without type annotations
# client = boto3.client("iot-jobs-data")

# Boto3 client with explicit type annotations for better IDE support and static analysis
if TYPE_CHECKING:
    client: IoTJobsDataPlaneClient = boto3.client("iot-jobs-data")
else:
    client = boto3.client("iot-jobs-data")

try:
    # Example: Describe a job execution
    job_id = "your-job-id"
    thing_name = "your-thing-name"
    
    # The response object will be implicitly typed due to the client annotation
    response: DescribeJobExecutionResponseTypeDef = client.describe_job_execution(
        jobId=job_id,
        thingName=thing_name
    )
    print(f"Job Execution Status: {response.get('execution', {}).get('status')}")
except client.exceptions.ResourceNotFoundException:
    print(f"Job execution for Job ID '{job_id}' and Thing Name '{thing_name}' not found.")
except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →