Registry /
type-stubs / mypy-boto3-cloudformation
Install & Compatibility
Where this runs
tested against v1.43.62 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.918s · 52.5MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.8s · import 0.848s · 53MB
51MB installed
● package 51MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
CloudFormationClient
✓ from mypy_boto3_cloudformation.client import CloudFormationClient
CloudFormationServiceName
✓ from mypy_boto3_cloudformation import CloudFormationServiceName
✗ from mypy_boto3_cloudformation import 'cloudformation'
Use the enum `CloudFormationServiceName` for the client name string for type safety.
StackSummaryTypeDef
✓ from mypy_boto3_cloudformation.type_defs import StackSummaryTypeDef
Example of importing a specific TypedDict for request/response structures.
This quickstart demonstrates how to obtain a type-hinted CloudFormation client from boto3 and perform a basic operation like listing stacks. It shows how to use the `CloudFormationClient` type for the client object and `StackSummaryTypeDef` for processing response data, ensuring static type checking of your boto3 interactions.
import boto3
from mypy_boto3_cloudformation.client import CloudFormationClient
from mypy_boto3_cloudformation.type_defs import StackSummaryTypeDef
from mypy_boto3_cloudformation import CloudFormationServiceName
# Get a typed CloudFormation client using CloudFormationServiceName for safety
client: CloudFormationClient = boto3.client(CloudFormationServiceName.CLOUDFORMATION)
# Example: List stacks and iterate with type hints
try:
response = client.list_stacks(StackStatusFilter=['CREATE_COMPLETE', 'UPDATE_COMPLETE'])
# response['StackSummaries'] is a list of StackSummaryTypeDef
stacks: list[StackSummaryTypeDef] = response.get('StackSummaries', [])
if stacks:
print("CloudFormation Stacks:")
for stack in stacks:
print(f" Name: {stack['StackName']}, Status: {stack['StackStatus']}, Id: {stack['StackId']}")
else:
print("No CREATE_COMPLETE or UPDATE_COMPLETE stacks found.")
except Exception as e:
print(f"Error listing stacks: {e}")
# The type checker (e.g., mypy) will now validate usage of `client`
# and `stack` objects against the CloudFormation API definition.
Debug
Known issues
breakingPython 3.8 support was removed for all mypy-boto3 packages, including mypy-boto3-cloudformation. Projects requiring type stubs must use Python 3.9 or newer.fixUpgrade your project's Python version to 3.9 or higher. If you must use Python 3.8, pin to an older `mypy-boto3-cloudformation` version (e.g., <1.42.0) and its corresponding `mypy-boto3-builder`.
affects: >= 8.12.0 of mypy-boto3-builder (which generates mypy-boto3-cloudformation versions >= 1.42.0)
breakingAll mypy-boto3 packages migrated to PEP 561-compliant distribution. This change primarily affects how type checkers locate stubs, potentially requiring adjustments in build configurations or explicit stub path declarations if you were relying on non-standard stub discovery methods.fixEnsure your `mypy` configuration (or other type checkers) correctly identifies `mypy-boto3-cloudformation` as a PEP 561-compliant stub package. For most users, this will work out-of-the-box, but check `mypy` output if stubs are not found.
affects: >= 8.12.0 of mypy-boto3-builder (which generates mypy-boto3-cloudformation versions >= 1.42.0)
breakingTypeDef naming conventions were changed for packed method arguments, shortening names (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`). Conflicting TypeDef `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`).fixReview and update your code to use the new, shorter TypeDef names for request/response payloads if you import them explicitly.
affects: >= 8.9.0 of mypy-boto3-builder (which generates mypy-boto3-cloudformation versions >= 1.39.0)
gotchaThis library provides type stubs for `boto3`, not the `boto3` runtime itself. You must install `boto3` separately for your code to actually run. Without `boto3`, `mypy-boto3-cloudformation` offers no functional benefit beyond type checking for a non-existent runtime.fixAlways install `boto3` alongside `mypy-boto3-cloudformation` using `pip install boto3 mypy-boto3-cloudformation`.
affects: All versions
gotchaFor optimal compatibility and accurate type hints, the major.minor version of `mypy-boto3-cloudformation` (e.g., 1.42.x) should ideally align with the major.minor version of your installed `boto3` (e.g., 1.42.x). Mismatches can lead to type checking errors or missing attributes if the underlying API changes.fixKeep `mypy-boto3-cloudformation` updated in sync with your `boto3` installation. Use `pip install --upgrade boto3 mypy-boto3-cloudformation` regularly.
affects: All versions
breakingThe `CloudFormationServiceName` constant has been removed from the top-level `mypy_boto3_cloudformation` package. Users should rely on `CloudFormationClient.service_name` or directly use the string literal 'cloudformation'.fixUpdate imports to remove `CloudFormationServiceName` and use `'cloudformation'` directly as the service name string, or access `client.service_name` from a `CloudFormationClient` instance.
affects: >= 8.13.0 of mypy-boto3-builder (which generates mypy-boto3-cloudformation versions >= 1.43.0)
breakingThe top-level constant `CloudFormationServiceName` has been removed. If you were importing it to refer to the CloudFormation service name, use `CloudFormationServiceResource` instead, or the literal string 'cloudformation'.fixUpdate your imports: replace `from mypy_boto3_cloudformation import CloudFormationServiceName` with `from mypy_boto3_cloudformation import CloudFormationServiceResource`.
affects: >= 8.12.0 of mypy-boto3-builder (which generates mypy-boto3-cloudformation versions >= 1.42.0)
Upgrade
Version history
1.43.62latest on PyPI · released Jul 31, 2026
Audit
Dependencies
boto3requiredRuntime dependency for which these are type stubs. The stubs themselves do not have a runtime dependency on boto3, but they are useless without it.
typing-extensionsoptionalMay be required for older Python versions (e.g., <3.10) for certain type features. Automatically managed by the builder's dependency resolution.