Skip to main content

Python wrapper for LiteParse - fast, lightweight PDF and document parsing

Project description

LiteParse Python

Python wrapper for LiteParse - fast, lightweight document parsing with optional OCR.

Installation

pip install liteparse

Prerequisites: The LiteParse Node.js CLI must be installed:

npm install -g liteparse
# or
npx liteparse --version

Quick Start

from liteparse import LiteParse

# Create parser
parser = LiteParse()

# Parse a document
result = parser.parse("document.pdf")
print(result.text)

# Access structured data
for page in result.pages:
    print(f"Page {page.pageNum}: {len(page.textItems)} text items")

Configuration

from liteparse import LiteParse

parser = LiteParse()

result = parser.parse(
    "document.pdf",
    ocr_enabled=False,
    max_pages=10,
    dpi=150,
    preserve_small_text=True,
)
print(result.text)

Batch Processing

For parsing multiple files, batch mode is significantly faster as it reuses the PDF engine:

from liteparse import LiteParse

parser = LiteParse(ocr_enabled=False)

# Parse all documents in a directory
result = parser.batch_parse(
    input_dir="./documents",
    output_dir="./output",
    recursive=True,              # Include subdirectories
    extension_filter=".pdf",     # Only PDF files
)

print(f"Parsed {result.success_count} files in {result.total_time_seconds}s")
print(f"Average: {result.avg_time_ms}ms per file")

Supported Formats

  • PDF (.pdf)
  • Microsoft Office (.docx, .xlsx, .pptx, etc.) - requires LibreOffice
  • OpenDocument (.odt, .ods, .odp) - requires LibreOffice
  • Images (.png, .jpg, .tiff, etc.) - requires ImageMagick
  • And more!

Performance Tips

  1. Disable OCR if your documents have selectable text:

    parser = LiteParse(ocr_enabled=False)
    
  2. Use batch mode for multiple files to avoid cold-start overhead:

    parser.batch_parse("./input", "./output")
    
  3. Limit pages if you only need specific pages:

    result = parser.parse("doc.pdf", target_pages="1-5")
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

liteparse-1.1.0.tar.gz (29.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

liteparse-1.1.0-py3-none-any.whl (8.5 kB view details)

Uploaded Python 3

File details

Details for the file liteparse-1.1.0.tar.gz.

File metadata

  • Download URL: liteparse-1.1.0.tar.gz
  • Upload date:
  • Size: 29.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for liteparse-1.1.0.tar.gz
Algorithm Hash digest
SHA256 228c95933a48777bbb5a4fb1d9ae6ee250550d4d81bf4ff6f60e71be12a63bc9
MD5 b8af8f2fa8bd574d74f933baf6b75471
BLAKE2b-256 081ea3606384ce65663d7bae0c4d6ab10163f646d488d136b21f122699f379e5

See more details on using hashes here.

File details

Details for the file liteparse-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: liteparse-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for liteparse-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4af5c6f38257fdb581a423fa2b421b6af9c12d14c2467446f821df3a29027cda
MD5 0d391c9c954fd30f7c3d9ba1a24d9c65
BLAKE2b-256 cecfe0cc128e8c14bbebf23cdedca147fc6bf0e0ad5d2c77115e946aadc7cb81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page