mypy-boto3-acm
mypy-boto3-acm provides type annotations for the `boto3` AWS Certificate Manager (ACM) service, generated by the `mypy-boto3-builder`. It enhances static analysis for `boto3` code, enabling robust type checking with tools like MyPy, Pyright, VSCode, and PyCharm. The library is currently at version 1.42.80, aligning with `boto3` versions, and is part of an actively maintained project with frequent updates.
Warnings
- breaking Python 3.8 support was removed with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 must upgrade their Python version to 3.9 or higher to use recent versions of `mypy-boto3-acm`.
- breaking The `mypy-boto3-builder` migrated to PEP 561 compliant packages in version 8.12.0. While this generally improves compatibility with `mypy`, older `mypy` versions or custom `MYPYPATH` configurations might require adjustments.
- breaking Starting from `mypy-boto3-builder` version 8.9.0, TypeDef naming conventions for method arguments were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved. This can cause type errors if you're explicitly referencing older TypeDef names.
- gotcha `mypy-boto3-acm` provides only type *stubs*. `boto3` (the actual AWS SDK for Python) must be installed separately for your code to run successfully at runtime.
- gotcha When using `TYPE_CHECKING` blocks for conditional imports, `pylint` may complain about 'undefined variables' in the `else` branch. This is a known issue with `pylint`'s handling of these blocks.
- gotcha PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads in `boto3-stubs`. This is a known issue (PY-40997).
Install
-
pip install mypy-boto3-acm -
pip install boto3 mypy
Imports
- ACMClient
from mypy_boto3_acm.client import ACMClient
- TagTypeDef
from mypy_boto3_acm.type_defs import TagTypeDef
Quickstart
from typing import TYPE_CHECKING
import boto3
if TYPE_CHECKING:
from mypy_boto3_acm.client import ACMClient
from mypy_boto3_acm.type_defs import CertificateSummaryTypeDef
# Example of a TypedDict for a specific API response item
# For a full list, refer to the mypy-boto3-acm documentation
def get_acm_certificates() -> list['CertificateSummaryTypeDef']:
client: ACMClient = boto3.client("acm")
response = client.list_certificates()
certificates = response.get("CertificateSummaryList", [])
return certificates
if __name__ == "__main__":
# Example usage (requires AWS credentials configured)
try:
certs = get_acm_certificates()
if certs:
print(f"Found {len(certs)} ACM certificates:")
for cert in certs:
print(f" ARN: {cert['CertificateArn']}, Domain: {cert.get('DomainName')}")
else:
print("No ACM certificates found.")
except Exception as e:
print(f"Error retrieving certificates: {e}")