mypy-boto3-imagebuilder type stubs

1.42.88 · active · verified Sat Apr 11

mypy-boto3-imagebuilder provides type annotations for the boto3 AWS Imagebuilder service, enabling static type checking with tools like mypy. It's part of the `mypy-boto3` family of packages, generated by `mypy-boto3-builder`. The package version (1.42.88) aligns with the boto3 version it provides stubs for, and new releases are published regularly to match boto3 updates and builder improvements.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to instantiate a type-hinted AWS Imagebuilder client using `boto3` and `mypy-boto3-imagebuilder` stubs. It then performs a `list_images` operation and accesses typed response data, showcasing how the stubs provide autocompletion and static type validation for client methods and response structures.

import boto3
from mypy_boto3_imagebuilder.client import ImagebuilderClient
from mypy_boto3_imagebuilder.type_defs import ImageSummaryTypeDef

# Instantiate a typed client
client: ImagebuilderClient = boto3.client("imagebuilder")

# Use the client with type-checking benefits
try:
    response = client.list_images(filters=[
        {
            'name': 'name',
            'values': ['example-image-name']
        }
    ])

    print(f"Found {len(response.get('imageSummaryList', []))} images.")

    # Example of accessing a typed item
    if response.get('imageSummaryList'):
        first_image: ImageSummaryTypeDef = response['imageSummaryList'][0]
        print(f"First image ARN: {first_image['arn']}")

except client.exceptions.ClientError as e:
    print(f"An AWS error occurred: {e}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

view raw JSON →