Kepler
A small diff and patch toolkit. One static binary, no runtime dependencies, a Python binding when you need it in a pipeline.
What it does
- computes minimal edit scripts between text and binary blobs;
- streams inputs, so memory use stays flat on large files;
- emits unified and context output, applies patches with configurable fuzz;
- ships two algorithms: Myers (default) and histogram for noisy sources.
Usage
kepler diff old.conf new.conf > change.patch
kepler patch -i change.patch -p2 --fuzz 2
kepler diff --algorithm histogram --context 5 a/ b/
Library
The binding exposes the same core; everything below is pure computation, nothing touches the network.
from kepler import diff, apply
patch = diff(b"alpha\nbeta\n", b"alpha\ngamma\n")
out = apply(b"alpha\nbeta\n", patch)
assert out == b"alpha\ngamma\n"
Build
A single translation unit and a four-line makefile. Cross targets for x86-64 and arm64 are built from the same source; the only flag that changes is the target triple.
make
make check
make install PREFIX=/usr/local
Compatibility
POSIX-ish systems. Patch format follows the usual unified conventions, so output can be
fed to patch(1) as well.
License
MIT.