Skip to content


Index > Imagebuilder > Examples

Auto-generated documentation for Imagebuilder type annotations stubs module mypy-boto3-imagebuilder.


Implicit type annotations#

Can be used with boto3-stubs[imagebuilder] package installed.

Write your Imagebuilder code as usual, type checking and code completion should work out of the box.

# ImagebuilderClient usage example

from boto3.session import Session

session = Session()

client = session.client("imagebuilder")  # (1)
result = client.cancel_image_creation()  # (2)
  1. client: ImagebuilderClient
  2. result: CancelImageCreationResponseTypeDef

Explicit type annotations#

With boto3-stubs-lite[imagebuilder] or a standalone mypy_boto3_imagebuilder package, you have to explicitly specify client: ImagebuilderClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# ImagebuilderClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_imagebuilder.client import ImagebuilderClient
from mypy_boto3_imagebuilder.type_defs import CancelImageCreationResponseTypeDef
from mypy_boto3_imagebuilder.type_defs import CancelImageCreationRequestRequestTypeDef

session = Session()

client: ImagebuilderClient = session.client("imagebuilder")

kwargs: CancelImageCreationRequestRequestTypeDef = {...}
result: CancelImageCreationResponseTypeDef = client.cancel_image_creation(**kwargs)