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

While the python package can auto-install the LiteParse CLI if not installed, it is recommended to do it separately:

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.2.0.tar.gz (29.5 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.2.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for liteparse-1.2.0.tar.gz
Algorithm Hash digest
SHA256 c6709e657905b39e72e1be03d75c650e157d41ee2ea4749389141712e1f5eaaf
MD5 a8ff1c441faaf2a8c3ca338a935d5091
BLAKE2b-256 e926b6c9d0e5da1f913327b7eecfea33063eecd1fbcefc49cb8c0d53c263a03b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for liteparse-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ed166e94e909beef2b65860efa1b17792207c3e8e1a8e158d86c0e9fc155199
MD5 9c047952a4534e304a5cc70e8256d39d
BLAKE2b-256 5cfc6678c63b9e4d859b3e0058acb8c5d332a172073fd425b64cfe7a7375ae9c

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