mypy-boto3-deadline: AWS Deadline Cloud Type Stubs
mypy-boto3-deadline provides static type annotations for the `boto3` AWS SDK's DeadlineCloud service, generated with mypy-boto3-builder 8.12.0. It enhances developer experience by enabling comprehensive type checking, improved IDE auto-completion, and early error detection for `boto3` code interacting with AWS Deadline Cloud. The current version is 1.42.84, with active development following `boto3` updates and new AWS service releases.
Warnings
- breaking Support for Python 3.8 has been removed in `mypy-boto3-builder` version 8.12.0, affecting all generated packages including `mypy-boto3-deadline`. Projects using Python 3.8 or older will encounter compatibility issues.
- breaking Generated `TypeDef` names may have changed in `mypy-boto3-builder` version 8.9.0. Specifically, packed method arguments use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`).
- gotcha `mypy-boto3-deadline` provides only type stubs and does not include the actual `boto3` runtime. Your application must have `boto3` installed to function at runtime. The type stubs are solely for static analysis.
- gotcha For large projects or when using PyCharm, performance issues with Literal overloads in type stubs (issue PY-40997) might lead to high CPU usage or slow IDE performance. This is a known issue affecting `boto3-stubs` and related packages.
- gotcha When using `mypy-boto3` stubs with `pylint`, you might encounter 'undefined variable' warnings for type-hinted variables. This is a known interaction issue when `TYPE_CHECKING` blocks are used without runtime fallback.
Install
-
pip install mypy-boto3-deadline boto3 mypy -
pip install 'boto3-stubs[deadline]' boto3 mypy
Imports
- DeadlineCloudClient
from mypy_boto3_deadline.client import DeadlineCloudClient
- AcceleratorCountRangeTypeDef
from mypy_boto3_deadline.type_defs import AcceleratorCountRangeTypeDef
Quickstart
import boto3
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mypy_boto3_deadline.client import DeadlineCloudClient
from mypy_boto3_deadline.type_defs import ListFleetsResponseTypeDef
def list_deadline_fleets() -> ListFleetsResponseTypeDef:
# Using type hint for the client provides auto-completion and type checking
client: DeadlineCloudClient = boto3.client("deadline")
response = client.list_fleets()
print(f"Found {len(response['fleets'])} fleets.")
return response
if __name__ == "__main__":
# This part runs only if the script is executed, not during type checking
# Replace with actual API calls or mock data for testing
try:
fleets_data = list_deadline_fleets()
# Access type-hinted data, e.g., fleets_data['nextToken']
except Exception as e:
print(f"Error listing fleets: {e}")