Skip to main content

Textract Form Parser

Build and Publish PyPI version Built with Cursor

A Python library for parsing AWS Textract form output. This library helps process and analyze form data extracted by AWS Textract, generating structured outputs and reports.

Features

  • Parse AWS Textract JSON output
  • Extract form fields and tables
  • Generate HTML reports
  • Create concise and verbose outputs
  • Command-line interface
  • Logging and debugging support

Installation

pip install textract-form-parser

Usage

As a Library

from textract_parser import analyze_document, generate_html_report, create_concise_results

# Load your Textract JSON
with open("notebook.json", "r") as f:
    textract_json = json.load(f)

# Analyze document
analysis_results = analyze_document(textract_json)

# Generate HTML report
generate_html_report(analysis_results, "report.html")

# Get concise results
concise_results = create_concise_results(analysis_results)

Command Line Interface

# Basic usage
textract-parser input.json -o output

# With verbose logging
textract-parser input.json -o output -v

Development

Setup

  1. Clone the repository:
git clone https://github.com/yogeshvar/text-extractor.git
cd text-extractor
  1. Create and activate virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install development dependencies:
pip install -e ".[dev]"
  1. Install pre-commit hooks:
pre-commit install

Code Formatting

Format code using the provided script:

./scripts/format.sh

This will:

  • Fix end of files
  • Fix trailing whitespace
  • Run Black formatter
  • Sort imports with isort
  • Stage formatted files

Testing

Run tests with coverage:

pytest --cov=textract_parser \
      --cov-report=term-missing \
      --html=test-results/report.html \
      --self-contained-html \
      -v

Commit Guidelines

We use conventional commits. Format:

<type>: <description>

[optional body]
[optional footer(s)]

Types:

  • feat: New feature
  • fix: Bug fix
  • enhance: Enhancement
  • docs: Documentation
  • style: Code style
  • refactor: Code refactoring
  • test: Testing
  • chore: Maintenance

Release Process

  1. Create a PR from your feature branch to master
  2. Ensure all tests pass
  3. Update version in:
    • setup.py
    • textract_parser/__init__.py
    • pyproject.toml
  4. Merge PR to master
  5. GitHub Actions will automatically:
    • Run tests
    • Create a new tag
    • Generate release notes
    • Create GitHub release
    • Publish to PyPI

License

MIT License - see LICENSE for details

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Format code (./scripts/format.sh)
  4. Commit changes (git commit -m 'feat: add amazing feature')
  5. Push to branch (git push origin feature/amazing-feature)
  6. Open a Pull Request

Authors

Release files for textract-form-parser 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for textract-form-parser 0.1.6
File Size Uploaded
textract_form_parser-0.1.6.tar.gz 548.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for textract-form-parser 0.1.6
File Interpreter ABI Platform
textract_form_parser-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 574.9 kB

Release files / textract_form_parser-0.1.6.tar.gz

Download URL textract_form_parser-0.1.6.tar.gz
Size 548.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9cab0c380c2af01248871add81d1d069ccf5a37f72f9203a0cba4608e1dc94a1
BLAKE2b-256 checksum
How to use checksums
efeff7f652ec626008f1b736ed79b153e5f09e17e77a463c397edf1a9e78591d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / textract_form_parser-0.1.6-py3-none-any.whl

Download URL textract_form_parser-0.1.6-py3-none-any.whl
Size 26.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b1fbba3e9352129d454a71b5d8f826129c83e9388dabf39bdff0694d08eed7b
BLAKE2b-256 checksum
How to use checksums
509ea9fb358d3dbf7a50dbe4f4b13de4fc1bf6c49ce833765e303b9771793b77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page