Skip to content

Examples#

Index > DataPipeline > Examples

Auto-generated documentation for DataPipeline type annotations stubs module mypy-boto3-datapipeline.

Client#

Implicit type annotations#

Can be used with boto3-stubs[datapipeline] package installed.

Write your DataPipeline code as usual, type checking and code completion should work out of the box.

# DataPipelineClient usage example

from boto3.session import Session


session = Session()

client = session.client("datapipeline")  # (1)
result = client.create_pipeline()  # (2)
  1. client: DataPipelineClient
  2. result: CreatePipelineOutputTypeDef
# DescribeObjectsPaginator usage example

from boto3.session import Session


session = Session()
client = session.client("datapipeline")  # (1)

paginator = client.get_paginator("describe_objects")  # (2)
for item in paginator.paginate(...):
    print(item)  # (3)
  1. client: DataPipelineClient
  2. paginator: DescribeObjectsPaginator
  3. item: DescribeObjectsOutputTypeDef

Explicit type annotations#

With boto3-stubs-lite[datapipeline] or a standalone mypy_boto3_datapipeline package, you have to explicitly specify client: DataPipelineClient type annotation.

All other type annotations are optional, as types should be discovered automatically. However, these type annotations can be helpful in your functions and methods.

# DataPipelineClient usage example with type annotations

from boto3.session import Session

from mypy_boto3_datapipeline.client import DataPipelineClient
from mypy_boto3_datapipeline.type_defs import CreatePipelineOutputTypeDef
from mypy_boto3_datapipeline.type_defs import CreatePipelineInputRequestTypeDef


session = Session()

client: DataPipelineClient = session.client("datapipeline")

kwargs: CreatePipelineInputRequestTypeDef = {...}
result: CreatePipelineOutputTypeDef = client.create_pipeline(**kwargs)
# DescribeObjectsPaginator usage example with type annotations

from boto3.session import Session

from mypy_boto3_datapipeline.client import DataPipelineClient
from mypy_boto3_datapipeline.paginator import DescribeObjectsPaginator
from mypy_boto3_datapipeline.type_defs import DescribeObjectsOutputTypeDef


session = Session()
client: DataPipelineClient = session.client("datapipeline")

paginator: DescribeObjectsPaginator = client.get_paginator("describe_objects")
for item in paginator.paginate(...):
    item: DescribeObjectsOutputTypeDef
    print(item)