mypy-boto3-appconfig

1.42.3 · active · verified Sat Apr 11

mypy-boto3-appconfig provides type annotations for the boto3 AppConfig service, enabling static type checking for AWS SDK for Python (boto3) usage. It helps catch potential bugs early and improves IDE support by offering auto-completion and type validation. The current version is 1.42.3, generated with mypy-boto3-builder 8.12.0, and its release cadence is tied to updates in boto3 and the builder itself.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to initialize a type-hinted AppConfig client using `mypy-boto3-appconfig` and retrieve a list of applications. It explicitly imports the client and response type definitions for static analysis.

import boto3
from mypy_boto3_appconfig.client import AppConfigClient
from mypy_boto3_appconfig.type_defs import ListApplicationsResponseTypeDef

def get_appconfig_applications() -> list[str]:
    # Ensure AWS credentials are configured (e.g., via environment variables, ~/.aws/credentials)
    # For this example, we'll assume they are, or use a dummy region for local testing.
    client: AppConfigClient = boto3.client("appconfig", region_name=os.environ.get('AWS_REGION', 'us-east-1'))
    try:
        response: ListApplicationsResponseTypeDef = client.list_applications()
        application_names = [app['Name'] for app in response.get('Items', []) if 'Name' in app]
        return application_names
    except Exception as e:
        print(f"Error listing AppConfig applications: {e}")
        return []

if __name__ == "__main__":
    import os
    # Set dummy credentials for runnable example if not already set
    if not os.environ.get('AWS_ACCESS_KEY_ID'):
        os.environ['AWS_ACCESS_KEY_ID'] = 'AKIAIOSFODNN7EXAMPLE'
        os.environ['AWS_SECRET_ACCESS_KEY'] = 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY'
        os.environ['AWS_REGION'] = 'us-east-1'

    applications = get_appconfig_applications()
    if applications:
        print("AppConfig Applications found:")
        for app_name in applications:
            print(f"- {app_name}")
    else:
        print("No AppConfig applications found or an error occurred.")

view raw JSON →