{"id":4295,"library":"types-boto3-cloudformation","title":"Type Annotations for boto3 CloudFormation","description":"types-boto3-cloudformation provides type annotations for the `boto3` AWS SDK's CloudFormation service, compatible with static analysis tools like mypy, pyright, and IDEs such as VSCode and PyCharm. It is generated by the `mypy-boto3-builder` (currently version 8.12.0) and typically releases updates in sync with `boto3` to provide accurate type hints for the latest AWS service APIs. The current version of these annotations is 1.42.3, matching `boto3`'s version.","status":"active","version":"1.42.3","language":"en","source_language":"en","source_url":"https://github.com/youtype/mypy_boto3_builder","tags":["aws","boto3","cloudformation","types","mypy","type-hints","stub","static-analysis","aws-sdk"],"install":[{"cmd":"pip install types-boto3-cloudformation","lang":"bash","label":"Install standalone package"},{"cmd":"pip install 'types-boto3[cloudformation]'","lang":"bash","label":"Install via types-boto3 extras"}],"dependencies":[{"reason":"Required Python version.","package":"python","optional":false},{"reason":"This package provides type hints for boto3. Boto3 itself must be installed separately to provide runtime functionality.","package":"boto3","optional":false}],"imports":[{"symbol":"CloudFormationClient","correct":"from types_boto3_cloudformation.client import CloudFormationClient"},{"symbol":"CloudFormationServiceResource","correct":"from types_boto3_cloudformation.service_resource import CloudFormationServiceResource"},{"symbol":"StackSummaryTypeDef","correct":"from types_boto3_cloudformation.type_defs import StackSummaryTypeDef"}],"quickstart":{"code":"import boto3\nfrom typing import TYPE_CHECKING\n\nif TYPE_CHECKING:\n    from types_boto3_cloudformation.client import CloudFormationClient\n    from types_boto3_cloudformation.type_defs import StackSummaryTypeDef\n\n# Create a boto3 client. Types are typically auto-discovered by IDEs/type checkers\n# if types-boto3-cloudformation is installed.\nclient: CloudFormationClient = boto3.client(\"cloudformation\")\n\ntry:\n    # Example: List CloudFormation stacks\n    response = client.list_stacks(StackStatusFilter=[\n        'CREATE_COMPLETE', 'UPDATE_COMPLETE', 'ROLLBACK_COMPLETE'\n    ])\n\n    print(\"CloudFormation Stacks:\")\n    for stack_summary: StackSummaryTypeDef in response.get(\"StackSummaries\", []):\n        print(f\"  - {stack_summary['StackName']} ({stack_summary['StackStatus']})\")\n\nexcept Exception as e:\n    print(f\"Error listing stacks: {e}\")\n    # In a real application, handle specific AWS exceptions like ClientError","lang":"python","description":"This quickstart demonstrates how to obtain a typed CloudFormation client and use it to list stacks. The `TYPE_CHECKING` block ensures the type imports are only used during static analysis, avoiding a runtime dependency if desired. You must have AWS credentials configured for boto3 to function (e.g., via `~/.aws/credentials` or environment variables)."},"warnings":[{"fix":"Upgrade your Python environment to 3.9 or higher.","message":"Python 3.8 support was removed with `mypy-boto3-builder` version 8.12.0. Users on Python 3.8 will need to upgrade to Python 3.9 or newer to use `types-boto3-cloudformation` versions generated by this builder version or newer.","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.12.0 (and corresponding types-boto3-cloudformation versions)"},{"fix":"Review and update `TypeDef` import paths and names in your code to match the new conventions.","message":"Type definition (TypeDef) naming conventions changed in `mypy-boto3-builder` 8.9.0. Specifically, packed method arguments use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes moved to the end (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`).","severity":"breaking","affected_versions":"mypy-boto3-builder >=8.9.0 (and corresponding types-boto3-cloudformation versions)"},{"fix":"Ensure `boto3` is installed in your project: `pip install boto3`.","message":"This package provides *only* type annotations. The actual `boto3` library must be installed separately for your code to run at runtime. `types-boto3-cloudformation` does not include or replace the `boto3` runtime.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Consider installing `types-boto3-lite-cloudformation` instead (`pip install types-boto3-lite-cloudformation`) or configure your PyCharm environment to use external type checkers.","message":"PyCharm users might experience slow performance or high CPU usage due to `Literal` overloads (issue PY-40997). The recommendation is to use `types-boto3-lite` versions or disable PyCharm's internal type checker and use `mypy` or `pyright` externally.","severity":"gotcha","affected_versions":"All versions (PyCharm specific)"},{"fix":"Ensure your static analysis tools (mypy, pyright) and IDEs are updated to their latest versions and configured to correctly discover PEP 561-compliant stub packages.","message":"With the migration to PEP 561 packages in `mypy-boto3-builder` 8.12.0, while core import paths should remain stable, there's a potential for tooling that relied on non-standard stub discovery mechanisms to require updates or configuration adjustments.","severity":"gotcha","affected_versions":"mypy-boto3-builder >=8.12.0 (and corresponding types-boto3-cloudformation versions)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}