Skip to content

Commit 80d8cf5

Browse files
committed
chore(scripts): drop the vestigial .venv-compare-pdf two-env split
Published docling ships one env that does everything, so VENV_PDF / PYBIN_PDF / ensure_docling_pdf were aliases of the single env and nothing ever created a separate `.venv-compare-pdf`. performance.sh's "probe lightweight, fall back to the PDF env" dance therefore just re-ran the exact same interpreter on the same input — dead code. Remove the aliases from _common.sh and collapse the probe in performance.sh to a single gate: if the local docling can convert the input, show the head-to-head; otherwise report Rust-only. Behaviour is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QYCj8stK1TzKcy6crtTfha
1 parent 47c1b51 commit 80d8cf5

2 files changed

Lines changed: 12 additions & 27 deletions

File tree

scripts/_common.sh

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
#
44
# Provides paths and helpers:
55
# ensure_docling — install the latest PUBLISHED docling into a venv
6-
# ensure_docling_pdf — alias of ensure_docling (one env now does everything)
76
# build_rust_release — build the release CLI and echo its path
87

98
_COMMON_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
@@ -17,12 +16,9 @@ PYBIN="$VENV/bin/python"
1716
PY_RUNNER="$_COMMON_DIR/docling_convert.py"
1817

1918
# Published docling (2.x) bundles every format backend AND the full PDF pipeline
20-
# (layout/table via docling-ibm-models → torch). There is no longer a no-torch
21-
# "lightweight" install, so a single env handles both declarative and PDF/image
22-
# conversion; the older two-venv split survives only as aliases below.
23-
VENV_PDF="$VENV"
24-
PYBIN_PDF="$PYBIN"
25-
19+
# (layout/table via docling-ibm-models → torch), so a single env handles both
20+
# declarative and PDF/image conversion — there is no separate PDF venv.
21+
#
2622
# We install the LATEST PUBLISHED docling from PyPI (not from local sources),
2723
# with the `easyocr` extra so the PDF/image head-to-head exercises docling's
2824
# default OCR backend.
@@ -52,11 +48,6 @@ ensure_docling() {
5248
echo ">> docling ready ($PYBIN)" >&2
5349
}
5450

55-
# The single published-docling env already carries the full PDF pipeline (torch +
56-
# layout/table models), so this is just an alias kept for callers that asked for
57-
# the heavier path explicitly.
58-
ensure_docling_pdf() { ensure_docling; }
59-
6051
# Build the optimized Rust CLI once and echo the binary path.
6152
build_rust_release() {
6253
cargo build --release --quiet --manifest-path "$MANIFEST" -p fleischwolf-cli >&2

scripts/performance.sh

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ bench_process() {
9191
# Warm, in-process Python: import once, then time RUNS conversions; report
9292
# avg seconds/conversion and peak RSS (KB).
9393
bench_python_warm() {
94-
"$PY_USED" - "$INPUT" "$PY_RUNNER" "$RUNS" <<'PY'
94+
"$PYBIN" - "$INPUT" "$PY_RUNNER" "$RUNS" <<'PY'
9595
import importlib.util, resource, sys, time
9696
from pathlib import Path
9797
@@ -111,28 +111,22 @@ print(f"{avg:.6f} {rss_kb}")
111111
PY
112112
}
113113

114-
# Pick the Python docling that can convert this input and label which pipeline it
115-
# runs. The env (`.venv-compare`) now does everything, so the label is driven by
116-
# the input format, not by which env answered: a PDF/image/audio input goes
117-
# through docling's full ML pipeline (layout + tables + OCR), every other format
118-
# through the torch-free declarative backend. A probe still gates whether a
119-
# head-to-head is shown at all (some formats the local docling can't convert).
114+
# The single `.venv-compare` env (installed by `ensure_docling` above) handles
115+
# every format, so the pipeline label is driven by the input format, not by which
116+
# env answered: a PDF/image/audio input goes through docling's full ML pipeline
117+
# (layout + tables + OCR), every other format through the torch-free declarative
118+
# backend. A probe gates whether a head-to-head is shown at all — some formats the
119+
# locally-installed docling can't convert, in which case we report Rust-only.
120120
case "${INPUT,,}" in
121121
*.pdf | *.png | *.jpg | *.jpeg | *.tif | *.tiff | *.bmp | *.webp | *.gif | *.wav | *.mp3 | *.flac | *.m4a)
122122
PY_KIND="full ML pipeline (layout + tables + OCR)" ;;
123123
*)
124124
PY_KIND="declarative backend (no torch)" ;;
125125
esac
126-
PY_USED="$PYBIN"
127126
PY_OK=1
128127
probe="$(mktemp)"
129128
if ! "$PYBIN" "$PY_RUNNER" "$INPUT" "$probe" >/dev/null 2>&1 || [[ ! -s "$probe" ]]; then
130-
: >"$probe"
131-
if ensure_docling_pdf && "$PYBIN_PDF" "$PY_RUNNER" "$INPUT" "$probe" >/dev/null 2>&1 && [[ -s "$probe" ]]; then
132-
PY_USED="$PYBIN_PDF"
133-
else
134-
PY_OK=0
135-
fi
129+
PY_OK=0
136130
fi
137131
rm -f "$probe"
138132

@@ -141,7 +135,7 @@ read -r rs_min rs_avg rs_rss rs_cpu < <(bench_process "$RUST_BIN" "$INPUT")
141135

142136
if [[ "$PY_OK" -eq 1 ]]; then
143137
echo ">> measuring Python docling [$PY_KIND] (end-to-end process) ..."
144-
read -r py_min py_avg py_rss py_cpu < <(bench_process "$PY_USED" "$PY_RUNNER" "$INPUT")
138+
read -r py_min py_avg py_rss py_cpu < <(bench_process "$PYBIN" "$PY_RUNNER" "$INPUT")
145139
echo ">> measuring Python docling (warm, in-process) ..."
146140
read -r pyw_avg pyw_rss < <(bench_python_warm 2>/dev/null) || { pyw_avg=""; pyw_rss=0; }
147141
fi

0 commit comments

Comments
 (0)