mypy-boto3-mpa: Type Annotations for boto3 Multiparty Approval Service

1.42.62 · active · verified Sat Apr 11

mypy-boto3-mpa provides precise type annotations for the boto3 Multiparty Approval (MPA) service, generated by the `mypy-boto3-builder`. It helps improve code quality and catch type-related errors at development time when working with the AWS MPA API using boto3. The current version is 1.42.62, and releases are frequent, typically in sync with new boto3/botocore releases and AWS service updates.

Warnings

Install

Imports

Quickstart

This example demonstrates how to obtain a type-hinted MPA client using `boto3.client` and import a specific TypeDef. `mypy` will then use the installed `mypy-boto3-mpa` stubs to provide static type checking for your boto3 calls. Note that `list_approval_rules` is a placeholder operation, and you'd replace it with an actual MPA API call in a functional application.

import boto3
from mypy_boto3_mpa.client import MPAClient
from mypy_boto3_mpa.type_defs import ListApprovalRulesOutputTypeDef

def get_mpa_rules() -> ListApprovalRulesOutputTypeDef:
    # mypy-boto3-mpa provides type hints for the boto3 client
    client: MPAClient = boto3.client("mpa")
    # Replace with an actual operation that returns a list of rules
    # For a real scenario, you'd call a valid MPA API operation.
    response: ListApprovalRulesOutputTypeDef = client.list_approval_rules() # type: ignore
    print(f"Found {len(response.get('ApprovalRules', []))} approval rules.")
    return response

if __name__ == '__main__':
    # This example requires boto3 and mypy-boto3-mpa to be installed.
    # The 'type: ignore' comment is used because 'list_approval_rules' 
    # is a placeholder and might not exist or require specific parameters.
    # In a real application, you would use actual MPA service methods.
    try:
        get_mpa_rules()
    except Exception as e:
        print(f"Could not fetch MPA rules (this is expected if the service method is a placeholder or not configured): {e}")

view raw JSON →