Install & Compatibility
Where this runs
tested against v1.43.82 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 18.7MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.6s · import 0.000s · 19MB
17MB installed
● package 17MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
OpenSearchServiceClient
✓ from mypy_boto3_opensearch import OpenSearchServiceClient
✗ from mypy_boto3_opensearch import OpenSearchServiceClient
Client
✓ from mypy_boto3_opensearch import Client
✗ from mypy_boto3_opensearch import OpenSearchServiceClient
ServiceResource
✓ from mypy_boto3_opensearch import ServiceResource
✗ from mypy_boto3_opensearch import OpenSearchServiceClient
This quickstart demonstrates how to use the `mypy-boto3-opensearch` stubs with a `boto3` OpenSearchService client. It initializes a type-hinted client, calls `list_domain_names`, and prints the results. Remember to have `boto3` installed and AWS credentials configured. The example uses environment variables for credentials, but `boto3` supports various credential providers. Run `mypy your_script.py` to see type checking in action.
import boto3
from mypy_boto3_opensearch.client import OpenSearchServiceClient
from mypy_boto3_opensearch.type_defs import ListDomainNamesResponseTypeDef
import os
# Ensure AWS credentials are configured (e.g., via environment variables or ~/.aws/credentials)
# For demonstration, using environment variables if available
aws_access_key_id = os.environ.get('AWS_ACCESS_KEY_ID', 'YOUR_ACCESS_KEY')
aws_secret_access_key = os.environ.get('AWS_SECRET_ACCESS_KEY', 'YOUR_SECRET_KEY')
aws_session_token = os.environ.get('AWS_SESSION_TOKEN', None)
# Initialize the boto3 client for OpenSearchService, type-hinted for mypy-boto3 stubs
client: OpenSearchServiceClient = boto3.client(
"opensearch",
region_name="us-east-1",
aws_access_key_id=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_session_token=aws_session_token
)
try:
# Use the client; type-checking will now be active when running `mypy`
response: ListDomainNamesResponseTypeDef = client.list_domain_names()
print("OpenSearch Domains:")
if response.get("DomainNames"):
for domain in response["DomainNames"]:
print(f"- {domain.get('DomainName')}")
else:
print(
"No domains found in us-east-1 region or credentials not configured correctly."
)
except Exception as e:
print(f"Error listing domains: {e}")
# To verify type checking, save this code as `your_script.py` and run `mypy your_script.py` in your terminal.
Debug
Known issues
breakingPython 3.8 support has been removed. Projects using `mypy-boto3-opensearch` must use Python 3.9 or newer.fixUpgrade your Python environment to 3.9 or higher.
affects: mypy-boto3-builder >= 8.12.0 (affecting stub packages generated from this builder version onwards)
breakingThe `mypy-boto3` ecosystem migrated to PEP 561 compliant packages. This improves how type checkers discover stubs but might require updates to custom build systems or environments that expect older packaging structures.fixEnsure your packaging and build tools are up-to-date and compatible with PEP 561. Reinstalling packages might resolve issues.
affects: mypy-boto3-builder >= 8.12.0 (affecting stub packages generated from this builder version onwards)
breakingSome TypeDef names were changed for improved consistency (e.g., `CreateDistributionRequestRequestTypeDef` to `CreateDistributionRequestTypeDef`). This change applies broadly across services and might affect custom type hints for OpenSearchService-related types.fixReview your codebase for TypeDef usages and update names according to the new conventions if they were affected.
affects: mypy-boto3-builder >= 8.9.0 (affecting stub packages generated from this builder version onwards)
gotcha`mypy-boto3-opensearch` provides type annotations for `boto3`, it is not a replacement for `boto3` itself. You must `pip install boto3` separately.fixEnsure both `boto3` and `mypy-boto3-opensearch` are installed (`pip install boto3 mypy-boto3-opensearch`).
affects: All versions
gotchaThis library provides type *stubs*. To actually perform type checking, you need to install and run `mypy` (or another compatible type checker) on your codebase.fixInstall `mypy` (`pip install mypy`) and integrate it into your development workflow.
affects: All versions
gotchaThe service name for OpenSearch in `boto3.client()` is `opensearch`, not `opensearchservice` or `os`.fixWhen creating a client, use `boto3.client("opensearch")`. affects: All versions
Upgrade
Version history
1.43.82latest on PyPI · released Aug 27, 2026
Audit
Dependencies
boto3requiredProvides the AWS SDK for Python that these stubs annotate.
typing-extensionsoptionalProvides backported typing features for older Python versions, automatically installed when needed.