mypy-boto3-pcs Type Stubs

1.42.75 · active · verified Sat Apr 11

mypy-boto3-pcs provides type annotations for the `boto3` ParallelComputingService, enhancing code completion and static analysis with tools like MyPy. It is part of the `mypy-boto3` project, which auto-generates type stubs for all `boto3` services and is actively maintained with frequent updates mirroring `boto3` releases.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to obtain a type-hinted `boto3` client for the ParallelComputingService using `mypy-boto3-pcs`. It emphasizes the need to install both `boto3` and the type stubs, and how to correctly annotate the client for static analysis.

import boto3
from mypy_boto3_pcs.client import ParallelComputingServiceClient
from os import environ

# Ensure boto3 is installed: pip install boto3 mypy-boto3-pcs

def get_pcs_client() -> ParallelComputingServiceClient:
    """Returns a type-hinted ParallelComputingService client."""
    # Boto3 client creation with type hint
    client: ParallelComputingServiceClient = boto3.client(
        'pcs',
        region_name=environ.get('AWS_REGION', 'us-east-1'),
        aws_access_key_id=environ.get('AWS_ACCESS_KEY_ID', ''),
        aws_secret_access_key=environ.get('AWS_SECRET_ACCESS_KEY', '')
    )
    return client

if __name__ == '__main__':
    pcs_client = get_pcs_client()
    # Now `pcs_client` has type hints for ParallelComputingService methods
    print(f"Client type: {type(pcs_client)}")
    # Example of a method call (replace with actual PCS method if needed)
    # This specific service 'pcs' is less common for simple public examples.
    # print(pcs_client.list_resources())

view raw JSON →