Registry / aws / amazon-textract-prettyprinter

amazon-textract-prettyprinter

JSON →
library0.1.10pypypi✓ verified 80d ago

A helper library for pretty printing Amazon Textract responses, providing a simple interface to convert Textract JSON output into formatted text, HTML, CSV, Markdown, and other formats. It is part of the amazon-textract-textractor suite. Current version: 0.1.10 (PyPI), but the repo is part of a larger project with versions up to 1.9.2. Release cadence is irregular; the PyPI package has not been updated since 2022. Requires Python >=3.6.

pip install amazon-textract-prettyprinter
INSTALL
IMPORT
SIG · AMAZON-TEXTRACT-PR
A
amazon-textract-prettyprinter
awspythonv0.1.10
Install
4.2s avg
Import
Disk
51MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.1.10 · 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
musl
py 3.103.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 52.7MB
glibc
py 3.103.910 runs
installs and imports cleanly · install 4.2s · import 0.000s · 53MB
51MB installed
● package 51MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Pretty_Print_Table_Format
from textractprettyprinter import Pretty_Print_Table_Format
from textractprettyprinter.t_pretty_print import Textract_PrettyPrint
t_pretty_print
from textractprettyprinter import t_pretty_print
from textractprettyprinter.t_pretty_print import Textract_PrettyPrint
get_layout_csv_from_trp2
from textractprettyprinter import get_layout_csv_from_trp2
from textractprettyprinter.t_pretty_print import Textract_PrettyPrint

Minimal example: call Textract on a PDF and print the response as plain text and CSV.

import boto3 from textractcaller.t_call import call_textract from textractprettyprinter.t_pretty_print import Textract_PrettyPrint # Call Textract API (make sure AWS credentials are configured) client = boto3.client('textract', region_name='us-east-1') response = call_textract(input_document="s3://bucket/document.pdf", client=client) # Pretty print as text pretty_printer = Textract_PrettyPrint() text_output = pretty_printer.print_text(response) print(text_output) # Pretty print as CSV (columns: Key, Value) csv_output = pretty_printer.print_csv(response) print(csv_output)
Debug
Known issues
breakingThe PyPI package version (0.1.10) is outdated and does not match the GitHub project versioning. Some features may be missing or broken. Use the package from the main repository (amazon-textract-textractor) for latest features.
fix
Install from the main repository: pip install amazon-textract-textractor (which includes prettyprinter).
affects: 0.1.10
deprecatedThe import path uses 'textractprettyprinter' (all lowercase, no hyphens) which is unusual. Many users mistake it for 'amazon_textract_prettyprinter'.
fix
Use correct import: from textractprettyprinter.t_pretty_print import Textract_PrettyPrint
affects: all
gotchaThe library assumes you have already called Textract and parsed the response. It does not call the Textract API itself. You must use amazon-textract-caller (or boto3 directly) to get the response object.
fix
Use call_textract from textractcaller to get the response, then pass to PrettyPrint methods.
affects: all
gotchaCSV, HTML, and Markdown output requires optional dependencies. If you try to use them without installing extras, you'll get ModuleNotFoundError.
fix
Install with extras: pip install amazon-textract-prettyprinter[html,csv,markdown]
affects: 0.1.10
Upgrade
Version history
0.1.10latest on PyPI · released May 15, 2024
Audit
Dependencies
amazon-textract-callerrequiredRequired for calling Textract API and converting response to PrettyPrinter compatible objects
amazon-textract-response-parserrequiredRequired for parsing Textract JSON into response objects
trpoptionalLegacy dependency, required for older format support
Agent activity
47 hits · last 30 days
node
40
Perplexity
1
OpenAI (training)
1
Resources
amazon-textract-prettyprinter — pip install amazon-textract-prettyprinter · libregistry