mypy-boto3-acm-pca
mypy-boto3-acm-pca provides type annotations (stubs) for the boto3 ACMPCA service, enabling static type checking with tools like MyPy. It is part of the broader mypy-boto3-builder project, which generates stubs for all AWS services. The current version is 1.42.3 and new versions are released regularly to keep pace with boto3 updates.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0, support for Python 3.8 has been removed across all `mypy-boto3` packages. This library (v1.42.3) requires Python >= 3.9.
- breaking In `mypy-boto3-builder` version 8.9.0, there were changes to how TypeDef names are generated, including shortening packed method argument TypeDefs and reordering postfixes for conflicting names. If you were directly importing and using these generated TypeDefs, your code may break.
- gotcha This package provides only type stubs. The `boto3` library itself is still required at runtime for your application to function correctly. Ensure `boto3` is installed alongside `mypy-boto3-acm-pca`.
- gotcha The `mypy-boto3` project migrated to PEP 561 compliant packages with `mypy-boto3-builder` version 8.12.0. While this is a standard for type stubs, older `mypy` versions or custom `mypy` configurations might struggle to locate the stubs correctly. Ensure `mypy` is up-to-date and configured to find installed packages.
Install
-
pip install mypy-boto3-acm-pca boto3
Imports
- ACMPCAClient
from mypy_boto3_acm_pca.client import ACMPCAClient
- ACMPCAClient
from typing import TYPE_CHECKING if TYPE_CHECKING: from mypy_boto3_acm_pca.client import ACMPCAClient
Quickstart
import boto3
from typing import TYPE_CHECKING
# The actual boto3 client is used at runtime
session = boto3.Session()
client = session.client("acm-pca")
# For type checking only, use conditional import
if TYPE_CHECKING:
from mypy_boto3_acm_pca.client import ACMPCAClient
# Type-hint the client for static analysis
typed_client: ACMPCAClient = client
# Example usage with type-hinted client
# These calls will be type-checked by MyPy
response = typed_client.list_certificate_authorities(
MaxResults=5,
Status='ACTIVE'
)
print(response.get('CertificateAuthorities'))
else:
# Runtime execution will use the untyped client
response = client.list_certificate_authorities(MaxResults=5)
print(response.get('CertificateAuthorities'))