mypy-boto3-osis Type Annotations
Type annotations for the `boto3` OpenSearch Ingestion (OSIS) service (version 1.42.3), generated with `mypy-boto3-builder`. These stubs provide type hints for IDEs and static analyzers like Mypy and Pyright, enhancing the development experience for AWS SDK users by offering autocompletion and early error detection. The library maintains an active release cadence, typically syncing with `boto3` versions.
Warnings
- breaking Starting with `mypy-boto3-builder` version 8.12.0, Python 3.8 is no longer supported for any generated `mypy-boto3-*` packages. Users must upgrade to Python 3.9 or newer.
- breaking In `mypy-boto3-builder` version 8.9.0, there were breaking changes to TypeDef naming conventions. Specifically, TypeDefs for packed method arguments use shorter names (e.g., `CreateDistributionRequestRequestTypeDef` -> `CreateDistributionRequestTypeDef`), and conflicting `Extra` postfixes were moved (e.g., `CreateDistributionExtraRequestTypeDef` -> `CreateDistributionRequestExtraTypeDef`). While the specific names may vary per service, this change affects type hints for service-specific request/response structures.
- gotcha This package (`mypy-boto3-osis`) provides only type stubs. For the code to run, the actual `boto3` library must be installed separately. The stubs enhance the development experience but do not provide runtime functionality.
- gotcha As of `mypy-boto3-builder` 8.12.0, all packages migrated to PEP 561 compliance. This is generally an improvement for type checker discovery but might require tools like `mypy` or IDEs to be updated to their latest versions to correctly find and utilize the stubs, especially in complex project setups.
- gotcha While many IDEs (like PyCharm) and `mypy` can often infer types automatically, explicit type annotations for `boto3.client()`, `session.client()`, `client.get_waiter()`, and `client.get_paginator()` calls are highly recommended, especially for VSCode users, to ensure full autocompletion and accurate type hints.
Install
-
pip install mypy-boto3-osis -
pip install 'boto3-stubs[osis]'
Imports
- OSISClient
from mypy_boto3_osis.client import OSISClient
- ListPipelinesResponseTypeDef
from mypy_boto3_osis.type_defs import ListPipelinesResponseTypeDef
- OSISServiceName
from mypy_boto3_osis.literals import OSISServiceName
Quickstart
import boto3
from mypy_boto3_osis.client import OSISClient
from mypy_boto3_osis.type_defs import ListPipelinesResponseTypeDef
# A boto3 session, typically configured via environment variables or AWS CLI
# For quickstart, we assume default configuration or minimal environment setup.
# Ensure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION are set in env if not using default profile.
def get_osis_pipelines() -> ListPipelinesResponseTypeDef:
# Initialize the boto3 client with type annotations
client: OSISClient = boto3.client("osis")
# Use a type-hinted client
response: ListPipelinesResponseTypeDef = client.list_pipelines()
print(f"Found {len(response.get('Pipelines', []))} OSIS pipelines.")
for pipeline in response.get('Pipelines', []):
print(f" - {pipeline.get('PipelineName')}")
return response
if __name__ == "__main__":
try:
get_osis_pipelines()
except Exception as e:
print(f"An error occurred: {e}")
print("Ensure 'boto3' is installed and AWS credentials/region are configured.")