mypy-boto3-odb Type Stubs

1.42.80 · active · verified Sat Apr 11

mypy-boto3-odb provides static type annotations for the boto3 Odb service client, enhancing development with type checking, auto-completion, and error detection in IDEs and with tools like Mypy. It is part of the 'mypy-boto3' ecosystem, automatically generated by `mypy-boto3-builder`, and is currently at version 1.42.80. The library receives frequent updates to align with upstream boto3 releases.

Warnings

Install

Imports

Quickstart

This example demonstrates how to import and apply type hints for the `OdbClient` and its response types. It initializes a `boto3` client with the `OdbClient` type, allowing static analysis tools like Mypy and IDEs to provide auto-completion and type checking for Odb service calls. The `TYPE_CHECKING` block ensures that the `mypy_boto3_odb` import is only active during type checking, avoiding a runtime dependency on the stubs if desired. Replace `get_profile` with actual Odb service operations.

import boto3
from typing import TYPE_CHECKING

if TYPE_CHECKING:
    from mypy_boto3_odb import OdbClient
    from mypy_boto3_odb.type_defs import GetProfileOutputTypeDef

def get_odb_profile(profile_id: str) -> GetProfileOutputTypeDef:
    # Initialize an Odb client with type hints
    client: OdbClient = boto3.client("odb")

    # Example API call (replace with actual Odb service calls)
    # The actual Odb service is not widely known; this is illustrative.
    response: GetProfileOutputTypeDef = client.get_profile(ProfileId=profile_id)
    print(f"Retrieved Odb profile for {profile_id}: {response.get('Name')}")
    return response

# Example usage (requires AWS credentials configured for boto3)
if __name__ == "__main__":
    # In a real scenario, profile_id would come from input or configuration
    sample_profile_id = "some-odb-profile-id"
    try:
        # This call will fail at runtime if the 'odb' service or 'get_profile' API 
        # does not exist or if credentials are not configured correctly.
        # The purpose here is to demonstrate type hinting at static analysis time.
        # response_data = get_odb_profile(sample_profile_id)
        print("Type hinting for OdbClient and response types demonstrated.")
        print("To run, ensure 'boto3' is installed and AWS credentials are configured.")
        print("Note: 'odb' is a less common AWS service; adjust API calls as needed.")
    except Exception as e:
        print(f"An error occurred: {e}")

view raw JSON →