mypy-boto3-supplychain

1.42.3 · active · verified Sat Apr 11

mypy-boto3-supplychain provides type annotations for the `boto3` AWS SupplyChain service, enhancing static type checking with tools like MyPy, Pyright, and improving IDE auto-completion. It is generated by `mypy-boto3-builder` and is currently at version 1.42.3, following the boto3 release cycle. The project maintains an active release cadence, frequently updating stubs to match new AWS service versions and features.

Warnings

Install

Imports

Quickstart

This example demonstrates how to use `mypy-boto3-supplychain` for type-hinting a boto3 SupplyChain client and its response. The `TYPE_CHECKING` guard ensures that `mypy-boto3` is only a development dependency. It retrieves and prints data integration flows.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_supplychain.client import SupplyChainClient
    from mypy_boto3_supplychain.type_defs import ListDataIntegrationFlowsOutputTypeDef


def get_supply_chain_flows() -> ListDataIntegrationFlowsOutputTypeDef:
    # boto3 client creation is untyped at runtime, hence the type hint below
    client: SupplyChainClient = boto3.client("supplychain")
    response = client.list_data_integration_flows()
    print(f"Found {len(response.get('dataIntegrationFlows', []))} data integration flows.")
    return response

if __name__ == "__main__":
    # Ensure AWS credentials are configured (e.g., via AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY env vars)
    # or AWS CLI configuration.
    try:
        flows = get_supply_chain_flows()
        # Accessing typed properties
        for flow in flows.get('dataIntegrationFlows', []):
            print(f"  Flow ID: {flow['dataIntegrationFlowId']}, Status: {flow['status']}")
    except Exception as e:
        print(f"An error occurred: {e}")
        print("Please ensure 'boto3' is installed and AWS credentials are configured.")

view raw JSON →