types-boto3-textract

raw JSON →
1.43.0 verified Fri May 01 auth: no python

Type annotations for the boto3 Textract service, generated by mypy-boto3-builder. Version 1.43.0 provides static type checking support for AWS Textract API calls. The package follows the boto3-stubs release cadence and is updated when boto3 service models change.

pip install types-boto3-textract
error ModuleNotFoundError: No module named 'mypy_boto3_textract'
cause The package is installed as 'types-boto3-textract', but the import module is 'mypy_boto3_textract'.
fix
Run pip install types-boto3-textract and import mypy_boto3_textract.
error AttributeError: module 'boto3' has no attribute 'client' with type hints
cause Did not import the typed stubs. boto3 itself does not have type annotations.
fix
Add from mypy_boto3_textract import TextractClient and annotate your client variable.
error TypeError: 'type' object is not subscriptable
cause Using Python <3.9 with `list[str]` style annotations; the stubs use `from __future__ import annotations` but older Python may not support them.
fix
Either upgrade Python to 3.9+ or use typing.List instead of list in your code.
error Cannot find reference 'TextractClient' in 'mypy_boto3_textract'
cause IDE cache issues or incorrect package version. Sometimes the stub files are missing.
fix
Reinstall package: pip install --upgrade types-boto3-textract. Also ensure your IDE is using the correct Python interpreter.
gotcha Package is auto-generated; version numbers do not reflect the boto3 runtime version. They are sequential and can jump non-linearly.
fix Pin to a specific version if you need stability. Use `boto3-stubs` for all services instead of individual packages.
deprecated Python 3.8 support was removed in version 8.12.0 of the builder (affects types-boto3-textract released after that date).
fix Upgrade to Python 3.9+ or use the last version that supported 3.8 (if available).
breaking TypeDef names for packed arguments changed in builder v8.9.0 (e.g., removed 'Request' suffix from some names). Code importing specific TypeDef names may break.
fix Do not rely on autogenerated TypeDef names directly; use the module's public API or inspect the stubs after upgrading.

Minimal usage: create a typed Textract client and call detect_document_text.

import boto3
from mypy_boto3_textract import TextractClient

def analyze_document() -> None:
    client: TextractClient = boto3.client('textract', region_name='us-east-1',
                                           aws_access_key_id=os.environ.get('AWS_ACCESS_KEY_ID', ''),
                                           aws_secret_access_key=os.environ.get('AWS_SECRET_ACCESS_KEY', ''))
    # Example: Detect text in an S3 object
    response = client.detect_document_text(
        Document={'S3Object': {'Bucket': 'my-bucket', 'Name': 'my-doc.pdf'}}
    )
    for block in response['Blocks']:
        if block['BlockType'] == 'LINE':
            print(block['Text'])