mypy-boto3-support
mypy-boto3-support provides type annotations for the AWS boto3 Support service. It enhances static type checking for boto3 clients, resources, and various response/request structures related to AWS Support. The current version is 1.42.3, and its releases are frequently tied to new `boto3` versions and `mypy-boto3-builder` updates, ensuring up-to-date type definitions.
Warnings
- breaking Support for Python 3.8 was removed starting with `mypy-boto3-builder` version 8.12.0. All generated `mypy-boto3-*` packages, including `mypy-boto3-support`, now require Python >=3.9.
- breaking All `mypy-boto3-*` packages, including `mypy-boto3-support`, migrated to PEP 561 (PyTyped) packages with `mypy-boto3-builder` 8.12.0. This might affect advanced build setups or explicit `MYPYPATH` configurations.
- breaking TypeDef naming conventions changed in `mypy-boto3-builder` 8.9.0. Some TypeDefs for packed method arguments now use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`). Conflicting `Extra` postfixes also moved.
- gotcha The `mypy-boto3-support` package provides *type stubs* for static analysis, not runtime implementations. You should still import and use `boto3` for actual AWS API calls. The stub package enhances type checking for your `boto3` usage.
- deprecated Specific AWS services may be deprecated or renamed by AWS, leading to changes in the corresponding `mypy-boto3-*` stub packages. For example, `sms-voice` was excluded from builds in `mypy-boto3-builder` 8.11.0, replaced by `pinpoint-sms-voice`.
Install
-
pip install mypy-boto3-support -
pip install boto3 mypy-boto3-support
Imports
- SupportClient
from mypy_boto3_support.client import SupportClient
- DescribeCasesResponseTypeDef
from mypy_boto3_support.type_defs import DescribeCasesResponseTypeDef
Quickstart
import boto3
from typing import TYPE_CHECKING
# The mypy-boto3-support package provides stubs for boto3's 'support' service.
# The actual runtime client comes from boto3.
if TYPE_CHECKING:
from mypy_boto3_support.client import SupportClient
from mypy_boto3_support.type_defs import DescribeCasesResponseTypeDef
def get_aws_support_cases() -> None:
# mypy will use the stubs to type-check this client
client: SupportClient = boto3.client("support")
# Example: Describe cases. Replace with actual parameters if needed.
# Using try-except for a more robust example, as actual AWS calls require credentials.
try:
response: DescribeCasesResponseTypeDef = client.describe_cases(displayId='case-000000000001')
print(f"Successfully described cases. Cases found: {len(response.get('cases', []))}")
if response.get('cases'):
print(f"First case ID: {response['cases'][0]['caseId']}")
except Exception as e:
print(f"Error describing cases: {e}")
print("Ensure you have AWS credentials configured and the 'support' service is enabled.")
if __name__ == "__main__":
get_aws_support_cases()