Skip to main content

Parsy — Document Intelligence Engine

PyPI Python License: MIT

Parsy is a high-performance, privacy-preserving document intelligence engine.
Parse PDFs, DOCX, HTML, TXT, CSV, JSON, and XML into clean Markdown, JSON, HTML, or CSV — fully locally with no data leaving your machine.


✨ Features

  • Blazing fast — Zero-copy PyMuPDF extraction, parallel page processing
  • 🔒 Private — Runs 100% locally, no internet required after install
  • 📄 Multi-format — PDF, DOCX, TXT, HTML, CSV, JSON, XML, XLSX
  • 🧠 ML-powered (optional) — Layout regions, semantic heading clusters, table structure
  • 🌊 SSE streaming — Real-time progressive output for large documents
  • 🖥️ CLI + Python API + REST API — Use however you want

📦 Installation

pip install parsy-doc

With optional ML structural analysis:

pip install parsy-doc[ml]

With OCR support (requires Tesseract installed on your system):

pip install parsy-doc[ocr]

Full installation:

pip install parsy-doc[all]

🚀 Quick Start

Python API

import parsy

# Parse a PDF to Markdown
result = parsy.parse("contract.pdf")
print(result.markdown)

# Parse to JSON
result = parsy.parse("invoice.pdf", format="json")
print(result.json)

# Access tables directly
for table in result.tables:
    print(table)

# View parsing metrics
print(result.metrics)
# → {'wordCount': 4231, 'pageCount': 18, 'charCount': 24100, ...}

Async API (FastAPI, asyncio)

import parsy
import asyncio

async def main():
    result = await parsy.parse_async("report.pdf", format="markdown")
    print(result.markdown)

asyncio.run(main())

💻 Command-Line Interface

After installing, a parsy command is available globally:

# Parse a PDF and print to terminal
parsy parse report.pdf

# Save to file in JSON format
parsy parse invoice.pdf --format json --output invoice.json

# Parse all PDFs in a folder (batch mode)
parsy parse docs/*.pdf --format markdown --output ./results/

# Enable ML analysis
parsy parse research_paper.pdf --ml

# Launch the local REST API server + web UI
parsy serve

# Custom host and port
parsy serve --host 0.0.0.0 --port 8080

# Check version
parsy --version

🌐 REST API Server

Start the streaming REST API server:

parsy serve
# → http://localhost:8000

Then use the web UI at http://localhost:8000 or POST to the API:

curl -X POST http://localhost:8000/parse \
  -F "file=@report.pdf" \
  -F "format=markdown"

The API uses Server-Sent Events (SSE) for real-time streaming progress.


⚙️ Options

Option Values Default Description
format markdown, json, html, csv, plaintext markdown Output format
tables bool True Extract tables
clean bool True Whitespace cleanup
use_ml bool False Enable ML structural analysis

🔬 Supported File Types

Format Extension Notes
PDF (digital) .pdf Full text + table extraction
PDF (scanned) .pdf OCR via Tesseract (pip install parsy-doc[ocr])
Word .docx Headings, paragraphs, tables
HTML .html, .htm Semantic extraction
Plain text .txt, .rtf Encoding auto-detected
Markdown .md Passthrough + re-format
Spreadsheet .xlsx, .csv Table-centric output
Data .json, .xml Structured extraction

🏛️ Architecture

parsy parse() / parse_async()
        │
        ▼
  DocumentRouter          ← heuristic inspection
        │
  ┌─────┴──────────┐
  │                │
Fast Parser     Vision OCR     ← PyMuPDF / Tesseract
  │
  ▼
Normalizer                     ← Markdown, JSON, HTML, CSV
  │
  ▼
ParseResult

📄 License

MIT — see LICENSE

Download files

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

Source Distribution

parsy_doc-3.0.2.tar.gz (78.8 kB view details)

Uploaded Source

Built Distribution

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

parsy_doc-3.0.2-py3-none-any.whl (76.9 kB view details)

Uploaded Python 3

File details

Details for the file parsy_doc-3.0.2.tar.gz.

File metadata

  • Download URL: parsy_doc-3.0.2.tar.gz
  • Upload date:
  • Size: 78.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for parsy_doc-3.0.2.tar.gz
Algorithm Hash digest
SHA256 f427cf51041d8bd6bfd3456a94982ec107102910735483db2af7c565dc163a0e
MD5 ab58c5aaa505a9a9a19c041530da7410
BLAKE2b-256 6bf01154ae124da39bbebcd844d7f12a0ddf773cc1aaae741ad383ba949e3a50

See more details on using hashes here.

File details

Details for the file parsy_doc-3.0.2-py3-none-any.whl.

File metadata

  • Download URL: parsy_doc-3.0.2-py3-none-any.whl
  • Upload date:
  • Size: 76.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.11.9

File hashes

Hashes for parsy_doc-3.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ab46f75bcc0c2edd1957f827eb86ab7d42d78a614ca627ff9a062336f346894c
MD5 7c9daeeaf7dd32f68c4047f2c4f4ea92
BLAKE2b-256 35f49ef210764b5a1770cf55043503092c5d2c2a8248e3adc01e90d759ba7e0f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 files

3.0.1

2 files

3.0.0

2 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