mypy-boto3-textract provides a complete set of type annotations for the boto3 Textract service. These stubs enable static type checking for boto3 client operations, improving code quality and developer experience by catching type-related errors at development time. It is generated by the mypy-boto3-builder project and typically releases new versions in sync with boto3 updates, currently at 1.42.3.
Install & Compatibility
Where this runs
tested against v1.43.0 · 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
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from mypy_boto3_textract import TextractClient
This quickstart demonstrates the core functionality of `mypy-boto3-textract`: obtaining a type-hinted `boto3` client for the Textract service. It showcases the import of the `TextractClient` type and its application when creating a `boto3.client` instance, enabling comprehensive static analysis of Textract operations without requiring live AWS credentials for the type-checking benefit itself.
import boto3
from mypy_boto3_textract.client import TextractClient
from mypy_boto3_textract.type_defs import AnalyzeDocumentResponseTypeDef, DocumentTypeDef # Import for detailed typing
def get_typed_textract_client() -> TextractClient:
"""
Demonstrates how to obtain a type-hinted Textract client.
The actual boto3 client is created, and the `TextractClient` type stub
provides static analysis for its methods.
"""
# boto3 automatically handles authentication via environment variables
# (e.g., AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY) or other credential providers.
# No explicit os.environ.get is typically needed here for the stubs to function,
# as they primarily assist static analysis, not runtime credential fetching.
client: TextractClient = boto3.client("textract", region_name="us-east-1") # Specify region for a valid client
print(f"Successfully obtained a type-hinted Textract client: {type(client)}")
# You can now use 'client' with full type-hinting support
# For example, client.analyze_document(...)
return client
if __name__ == '__main__':
typed_client = get_typed_textract_client()
# At this point, `typed_client` has all the type hints for the Textract service,
# enabling static analysis in your IDE or with mypy.
# A live call (e.g., typed_client.analyze_document(...)) would require
# valid AWS credentials and appropriate permissions at runtime.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.