Skip to content

Examples#

Index > ECR > Examples

Auto-generated documentation for ECR type annotations stubs module mypy-boto3-ecr.

Client#

Implicit type annotations#

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

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

# ECRClient usage example

from boto3.session import Session


session = Session()

client = session.client("ecr")  # (1)
result = client.batch_check_layer_availability()  # (2)
  1. client: ECRClient
  2. result: BatchCheckLayerAvailabilityResponseTypeDef
# DescribeImageScanFindingsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("ecr")  # (1)

paginator = client.get_paginator("describe_image_scan_findings")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: ECRClient
  2. paginator: DescribeImageScanFindingsPaginator
  3. item: DescribeImageScanFindingsResponseTypeDef
# ImageScanCompleteWaiter usage example

from boto3.session import Session


session = Session()
client = session.client("ecr")  # (1)

waiter = client.get_waiter("image_scan_complete")  # (2)
waiter.wait()
  1. client: ECRClient
  2. waiter: ImageScanCompleteWaiter

Explicit type annotations#

With boto3-stubs-lite[ecr] or a standalone mypy_boto3_ecr package, you have to explicitly specify client: ECRClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type ann