Releases: adam2go/purepatch
Releases · adam2go/purepatch
purepatch 0.1.1
Performance release — identical behavior (all 29 tests green throughout, including the 500-case three-way differential suite vs GNU patch and git apply), measurably faster everywhere it matters:
- Failed-match diagnostics 21× faster (207 → 9.7 ms on a 10k-line file): two-pass candidate scoring — cheap word-set overlap prefilter, SequenceMatcher only on the top candidates. Agents wait on the failure path too.
- Drifted-patch placement: tiered C-speed anchor search (expected position → ±4096-line window scan → whole range → index only under pathological repetition). A patch drifted by 500 lines in a 20k-line file applies in ~1.5 ms.
- Large patches ~1.2× faster: single-pass source-coordinate rebuild instead of per-hunk list splicing, fused hunk decomposition, C-level slice comparisons, tight parser inner loop.
- Clean-path small patches now ~0.021 ms — ~120× faster than spawning GNU patch, ~370× faster than git apply (median of 7, verified outputs first).
Remaining time on big files is dominated by raw text split/join (C code) — the pure-Python floor.
purepatch 0.1.0
First release. The patch engine for code agents, in pure Python — apply unified diffs and fuzzy SEARCH/REPLACE edits with no git, no patch binary.
- GNU patch semantics: cumulative offsets, bidirectional position search, fuzz degradation
- Verified by differential testing in CI: 500 random patches three-way byte-identical (purepatch ≡ GNU patch ≡ git apply), 200 drift + 200 rotted-context scenarios matching GNU patch, 300 round-trip property cases
- Fuzzy edit ladder for LLM edit blocks: exact → whitespace tolerance → indentation transplant; ambiguity is refused, failures report the closest near-miss so an agent can self-correct
- Git extended headers (new/delete/rename, quoted paths), \ No newline markers, CRLF content
- ~25 µs per small patch in-process vs 2.6 ms spawning GNU patch (~100×) / 7.3 ms git apply (~290×) — median of 7, three rounds, outputs verified equal before timing
- CPython 3.9–3.14 + PyPy, zero dependencies