delta-reduce
A delta-reduction tool for minimising a file to the smallest version that still satisfies a given test. Similar in spirit to CReduce, but simpler: it only deletes lines, not arbitrary sub-expressions or tokens.
How it works
The tool repeatedly tries to delete chunks of lines from the input file. It scans from the bottom of the file upward, testing each deletion. The chunk size starts at the full file size and is reduced as the algorithm makes passes over the file. After 4 successful deletions the chunk size grows again, speeding up reduction when progress is easy. This repeats until a full pass removes nothing.
Multiple passes alternate an offset of 0 and 1 to avoid missing deletions that straddle chunk boundaries.
Installation
pip install delta-reduce
Usage
delta-reduce --test <script> --input <file> [-n <threads>]
| Option | Description |
|---|---|
--test SCRIPT |
Script that exits 0 if the candidate file is acceptable, non-zero otherwise. |
--input FILE |
File to reduce. Overwritten in place as progress is made. |
-n N |
Number of parallel threads (default: 4). |
-v, --verbose |
Print each tested deletion with its line range, chunk size, duration, and result. |
The original file is backed up to <file>.orig on the first run. Subsequent runs will not overwrite it.
Test script interface
The script is invoked with its working directory set to a temporary directory containing the candidate file under the original filename. Any external resources must be referenced by absolute path.
#!/bin/sh
# Example: keep reducing as long as the file still triggers a compiler error
gcc -c input.c 2>&1 | grep -q 'use of undeclared identifier'
Development
uv venv && uv pip install -e .
pytest
Metadata
Release files for delta-reduce 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| delta_reduce-0.1.2.tar.gz | 7.9 kB | Without provenance | Details for delta_reduce-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| delta_reduce-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for delta_reduce-0.1.2-py3-none-any.whl |
Total release size: 13.7 kB
Release files / delta_reduce-0.1.2.tar.gz
| Download URL | delta_reduce-0.1.2.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
174639b49084236e4f005f18e253ee1c9e94f5756f98bc696b77a9dfc4609fef
|
|
BLAKE2b-256 checksum How to use checksums |
79ffdd35290110d756debe5e21235ebefa16a3ac29b7d52c678b816f69f7deeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / delta_reduce-0.1.2-py3-none-any.whl
| Download URL | delta_reduce-0.1.2-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50cad6bddbeaacf301e12b597ab5a45e1763e589a61873c3440553bc59fe57a5
|
|
BLAKE2b-256 checksum How to use checksums |
f8576305b03efb3348048e629ac8eeab2e6184a7fa5386f667f37f60927dc54a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.22 {"installer":{"name":"uv","version":"0.9.22","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for delta-reduce 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.