mypy-boto3-datapipeline Type Stubs
mypy-boto3-datapipeline provides static type annotations for the `boto3` DataPipeline service, generated by `mypy-boto3-builder`. It enhances development with type-checking capabilities for `boto3` clients, resources, and waiters, without altering runtime behavior. The current version is 1.42.3, and releases are frequent, typically mirroring new `boto3` versions.
Warnings
- breaking Python 3.8 support was removed for `mypy-boto3-builder` in version 8.12.0. Consequently, `mypy-boto3-datapipeline` versions built with this builder (e.g., 1.42.3 and newer) require Python 3.9 or higher.
- breaking With `mypy-boto3-builder` 8.9.0, some `TypeDef` names were shortened (e.g., `CreateDistributionRequestRequestTypeDef` became `CreateDistributionRequestTypeDef`) or adjusted for conflicts (e.g., `CreateDistributionExtraRequestTypeDef` to `CreateDistributionRequestExtraTypeDef`). If you explicitly import and use these type definitions, your code might break.
- gotcha These packages provide only type stubs for `boto3`. The `boto3` library itself is a separate runtime dependency and must be installed alongside `mypy-boto3-datapipeline` for your code to execute.
- gotcha mypy-boto3 packages are exclusively for static type checking (e.g., with MyPy or Pyright) and do not modify the runtime behavior of the `boto3` library. They are purely for design-time analysis and do not need to be imported at runtime.
Install
-
pip install boto3 mypy-boto3-datapipeline
Imports
- DataPipelineClient
from mypy_boto3_datapipeline.client import DataPipelineClient
- Client via boto3.client
import boto3 from typing import TYPE_CHECKING if TYPE_CHECKING: from mypy_boto3_datapipeline.client import DataPipelineClient def get_datapipeline_client() -> DataPipelineClient: return boto3.client('datapipeline') - CreatePipelineInputRequestTypeDef
from mypy_boto3_datapipeline.type_defs import CreatePipelineInputRequestTypeDef
Quickstart
import boto3
from typing import TYPE_CHECKING
# Ensure both boto3 and mypy-boto3-datapipeline are installed:
# pip install boto3 mypy-boto3-datapipeline
if TYPE_CHECKING:
# Import the client type for explicit type hints within type-checking blocks
from mypy_boto3_datapipeline.client import DataPipelineClient
# Obtain a DataPipeline client. Mypy will use the installed stubs for type checking.
datapipeline_client: DataPipelineClient = boto3.client("datapipeline")
print("Attempting to list DataPipeline pipelines:")
try:
response = datapipeline_client.list_pipelines()
pipelines = response.get("pipelineIdList", [])
if pipelines:
print(f"Found {len(pipelines)} pipelines:")
for pipeline_info in pipelines:
# Type checkers will enforce that 'id' and 'name' exist and are strings
print(f"- ID: {pipeline_info['id']}, Name: {pipeline_info['name']}")
else:
print("No DataPipeline pipelines found in this AWS account/region.")
except datapipeline_client.exceptions.ClientError as e:
print(f"AWS Client Error: {e}")
except Exception as e:
print(f"An unexpected error occurred: {e}")
# Mypy will now correctly check types for datapipeline_client methods.
# For example, calling a non-existent method like 'datapipeline_client.non_existent_method()'
# would raise a Mypy error during static analysis.