Add LiteParse plugin for PDF text extraction#13
Merged
Conversation
…LiteParse New plugin that uses the `lit` CLI (@llamaindex/liteparse npm package) to extract text and metadata from PDF documents. Follows the same patterns as defuddle and opendataloader plugins. - config.json with LITEPARSE_ENABLED, LITEPARSE_TIMEOUT, LITEPARSE_ARGS, LITEPARSE_ARGS_EXTRA, LITEPARSE_BINARY options - on_Crawl hook emits Binary record for auto-install via npm - on_Snapshot hook finds PDFs from sibling plugins and extracts text+JSON - Full live integration tests with real PDF downloads, real binary install, and real content assertion (no mocks) https://claude.ai/code/session_01XyzPfEB3qopffFuRyouaTa
…eywords
- test_extract_single_pdf: uses pdfobject.com sample.pdf and asserts the
exact phrases "This is a simple PDF file" and "consectetuer adipiscing elit"
that appear on its pages
- test_extract_multiple_pdfs: uses two distinct PDFs (unec.edu.az and
pdfobject.com) and asserts unique text from BOTH is present in combined
output ("preserves all...colours and graphics" from PDF A, "This is a
simple PDF file" from PDF B)
https://claude.ai/code/session_01XyzPfEB3qopffFuRyouaTa
…() in all plugin tests All 8 plugin test files (defuddle, opendataloader, mercury, readability, ytdlp, gallerydl, forumdl, liteparse) had ~80-line get_*_binary_path() functions that manually tried Binary.load(), caught the exception, then shelled out to crawl hooks + npm/pip install hooks as a fallback. Binary.load_or_install() does all of this in one call. This removes ~600 lines of duplicated boilerplate, eliminates noisy BinaryLoadError log lines from the first-attempt failure, and removes unused imports (uuid, subprocess for install, tempfile for lib roots). https://claude.ai/code/session_01XyzPfEB3qopffFuRyouaTa
…ild failure 1. Shebang test: skip executable bit + shebang checks for __init__.py, test files, and utils — these aren't meant to be run as scripts. 2. Forumdl test: add pip overrides matching the crawl hook — install with --no-deps and chardet==5.2.0 instead of cchardet, which can't compile on Python 3.12+ (longintrepr.h removed). https://claude.ai/code/session_01XyzPfEB3qopffFuRyouaTa
Contributor
There was a problem hiding this comment.
1 issue found across 2 files (changes from recent commits).
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/test_plugin_executables_have_shebang.py">
<violation number="1" location="tests/test_plugin_executables_have_shebang.py:37">
P1: Custom agent: **Test quality checker**
This test now bails out early with `continue`, skipping validations for part of the discovered scripts; that violates the test-quality requirement forbidding skipped/bail-early test paths.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new LiteParse plugin that extracts text and metadata from PDF documents using the
litCLI tool by LlamaIndex. The plugin discovers PDFs from other plugin outputs (pdf, responses, staticfile) and processes all found documents, combining results into unified text and JSON outputs.Key Changes
Snapshot hook (
on_Snapshot__61_liteparse.py): Main extraction logic that:lit parseon each PDF in both text and JSON formatsnoresults)Crawl hook (
on_Crawl__43_liteparse_install.finite.bg.py): Binary dependency declaration that:littool@llamaindex/liteparsepackageLITEPARSE_ENABLEDflag and customLITEPARSE_BINARYpathsConfiguration (
config.json): Schema defining:LITEPARSE_ENABLED: Toggle extraction on/offLITEPARSE_BINARY: Custom binary pathLITEPARSE_TIMEOUT: Extraction timeout (default 120s)LITEPARSE_ARGS/LITEPARSE_ARGS_EXTRA: Command-line argumentsComprehensive test suite (
test_liteparse.py): Integration tests covering:Implementation Details
lit parsecommand with both text and JSON output formats<!-- source: ... -->)TIMEOUTenvironment variable for timeout configurationhttps://claude.ai/code/session_01XyzPfEB3qopffFuRyouaTa
Summary by cubic
Adds a LiteParse plugin that uses the
litCLI to extract text and JSON from PDFs found in sibling plugin outputs, writingcontent.txt,content.json, andmetadata.json. Also simplifies binary resolution in tests and fixes shebang checks andforum-dlinstall issues on Python 3.12.New Features
pdf,responses, andstaticfilefor PDFs and runslit parsein text and JSON modes.content.json(single JSON or array) andmetadata.json.LITEPARSE_ENABLED,LITEPARSE_BINARY,LITEPARSE_TIMEOUT,LITEPARSE_ARGS,LITEPARSE_ARGS_EXTRA; returnsnoresultswhen none found andfailedif the binary can’t run.litwith npm install via@llamaindex/liteparse, supportsenv,npm, and honors custom paths.Refactors
defuddle,forumdl,gallerydl,mercury,opendataloader,readability,ytdlp, andliteparsenow useBinary.load_or_install()(large boilerplate reduction).__init__, tests, utils) to avoid false failures.forum-dltest installs with--no-deps,--prefer-binary, and pinschardet==5.2.0to avoidcchardetbuild failures on Python 3.12.Written for commit a36840f. Summary will update on new commits.