mypy-boto3-application-autoscaling Type Stubs

1.42.3 · active · verified Sat Apr 11

This library provides type annotations (stubs) for the `boto3` client for the AWS Application Auto Scaling service. It enables static type checking with tools like Mypy, improving code reliability and developer experience when working with AWS SDK for Python. The current version is 1.42.3, and releases typically follow the `boto3` release cycle, with new stub packages generated for each new `boto3` version.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to type-annotate a `boto3` Application Auto Scaling client using `mypy-boto3-application-autoscaling` stubs. It also shows how to use specific `TypeDef` for API response objects, enabling Mypy to validate attribute access and types.

import boto3
from mypy_boto3_application_autoscaling import ApplicationAutoScalingClient
from mypy_boto3_application_autoscaling.type_defs import DescribeScalableTargetsResponseTypeDef

def list_scalable_targets() -> None:
    # Using type hint for the boto3 client
    client: ApplicationAutoScalingClient = boto3.client('application-autoscaling')

    # Example API call
    response: DescribeScalableTargetsResponseTypeDef = client.describe_scalable_targets(
        ServiceNamespace='ec2'
    )

    print(f"Scalable targets found: {len(response['ScalableTargets'])}")
    for target in response['ScalableTargets']:
        print(f"- Resource ID: {target['ResourceId']}, Dimension: {target['ScalableDimension']}")

# To run type checking:
# 1. Save this as a Python file (e.g., `main.py`)
# 2. Run `mypy main.py` in your terminal

# To execute the code (requires AWS credentials configured):
# list_scalable_targets()

view raw JSON →