Install & Compatibility
Where this runs
tested against v1.43.76 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.822s · 52.7MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 2.9s · import 0.748s · 53MB
51MB installed
● package 51MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CloudFrontClient
✓ from mypy_boto3_cloudfront.client import CloudFrontClient
✗ from mypy_boto3_cloudfront import CloudFrontClient
Client
✓ from mypy_boto3_cloudfront.client import Client
ServiceResource
✓ from mypy_boto3_cloudfront import ServiceResource
This example demonstrates how to initialize a `boto3` CloudFront client with type hints and retrieve a list of distributions. It uses `TYPE_CHECKING` for conditional imports, ensuring the stub package is only a development dependency. The response items are type-hinted using a `DistributionSummaryTypeDef`.
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_cloudfront.client import CloudFrontClient
from mypy_boto3_cloudfront.type_defs import DistributionSummaryTypeDef
# Instantiate a boto3 client (type-hinted for mypy)
cloudfront_client: 'CloudFrontClient' = boto3.client('cloudfront')
# Example: List distributions with type-hinted response
try:
response = cloudfront_client.list_distributions()
distributions: list['DistributionSummaryTypeDef'] = response.get('DistributionList', {}).get('Items', [])
if distributions:
print(f"Found {len(distributions)} CloudFront distributions.")
for dist in distributions:
print(f" Distribution ID: {dist.get('Id')}, Domain Name: {dist.get('DomainName')}")
else:
print("No CloudFront distributions found.")
except Exception as e:
print(f"Error listing distributions: {e}")
Debug
Known issues
breakingStarting with `mypy-boto3-builder` version 8.12.0 (which generated `mypy-boto3-cloudfront 1.42.80`), support for Python 3.8 has been removed. Projects using this version of the stubs or newer require Python 3.9 or higher.fixUpgrade your Python environment to 3.9 or newer.
affects: mypy-boto3-builder >= 8.12.0, mypy-boto3-cloudfront >= 1.42.80 (generated by 8.12.0)
breakingBuilder version 8.9.0 introduced breaking changes to TypeDef naming conventions. For instance, `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`, and `CreateDistributionExtraRequestTypeDef` became `CreateDistributionRequestExtraTypeDef`. If you're explicitly using these full TypeDef names, they may need to be updated.fixUpdate your code to use the new, shorter TypeDef names. Refer to the specific service's documentation for exact TypeDef names.
affects: mypy-boto3-builder >= 8.9.0, mypy-boto3-cloudfront >= 1.42.80 (generated by 8.12.0)
gotchaThe version of `mypy-boto3-cloudfront` typically aligns with the `boto3` version it provides stubs for (e.g., `1.42.80` for `boto3==1.42.80`). Using significantly mismatched `boto3` and `mypy-boto3-*` versions can lead to type checking errors or missing type hints if API signatures have changed between versions.fixEnsure your `boto3` and `mypy-boto3-cloudfront` package versions are as closely aligned as possible, ideally using the same major and minor version numbers where applicable.
affects: All versions
gotchaWhen using explicit type annotations, some IDEs (like VSCode without full function overload support) may require explicitly importing `Client` types and `TypeDef` structures. While `mypy` and PyCharm might infer types more readily, explicit imports ensure consistent behavior across tools.fixFor maximum compatibility and clarity, explicitly import `CloudFrontClient` and any `TypeDef`s from `mypy_boto3_cloudfront.client` and `mypy_boto3_cloudfront.type_defs` respectively. Consider using `if TYPE_CHECKING:` for development-only dependencies.
affects: All versions
Upgrade
Version history
1.43.76latest on PyPI · released Aug 20, 2026
Audit
Dependencies
boto3optionalThis package provides type stubs for the `boto3` library; `boto3` must be installed separately for runtime functionality.