mypy-boto3-appconfig
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
- breaking Support for Python 3.8 was removed in `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 must either upgrade to Python 3.9+ or pin their `mypy-boto3` related packages to an older version (pre-8.12.0) that still supports Python 3.8.
- breaking In `mypy-boto3-builder` version 8.9.0, TypeDef naming conventions changed for packed method arguments (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) and conflicting `Extra` postfixes were moved. This affects all `mypy-boto3` service packages, including `mypy-boto3-appconfig`, if you relied on specific TypeDef names.
- gotcha The `mypy-boto3` ecosystem migrated to PEP 561 compliant packages in `mypy-boto3-builder` version 8.12.0. While this generally improves type checker integration, ensure your `mypy` and IDE configurations are up-to-date to correctly interpret these new package structures.
- gotcha Some IDEs (like VSCode without specific settings) may require explicit type annotations for `boto3.client()` or `session.client()` calls to get full auto-completion, even though `mypy` itself might infer types correctly.
Install
-
pip install mypy-boto3-appconfig boto3 mypy
Imports
- AppConfigClient
from mypy_boto3_appconfig.client import AppConfigClient
- AppConfigServiceResource
from mypy_boto3_appconfig.service_resource import AppConfigServiceResource
- ListApplicationsResponseTypeDef
from mypy_boto3_appconfig.type_defs import ListApplicationsResponseTypeDef
- AppConfigPaginator
from mypy_boto3_appconfig.paginator import ListApplicationsPaginator
Quickstart
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.")