bumpplan reads a pinned Python lockfile, the project's direct requirements, package metadata and a directory of OSV advisories, and computes the smallest set of version bumps that clears every fixable advisory without breaking a declared constraint. The plan is optimal under a stated lexicographic objective, and that claim is tested against exhaustive search. Every advisory it cannot clear comes with a reason, and when the cause is a conflict, an irreducible core that includes the solver's own rules (a yanked release, a downgrade below the lock), and every plan is re-checked by an independent verifier. All bundled data is synthetic: package names and advisory ids (DEMO-2026-NNNN) are fictional.
A team runs a dozen Python services with pinned requirements. The scanner lists dozens of advisories per service, and single-package bump pull requests conflict with each other: fixing an HTTP client needs a newer connection pool, which a cloud SDK pins below the fix. Engineers either bump everything and break production, or leave advisories open. What they need is the smallest constraint-consistent set of upgrades, and for each advisory that cannot be cleared, the exact constraints that block it.
flowchart LR
L[Lockfile<br/>requirements.txt or pylock.toml] --> M
P[Direct requirements<br/>pyproject.toml] --> M
I[Index metadata<br/>versions, yanked, requires_dist] --> M
A[OSV advisories<br/>ECOSYSTEM ranges] --> M
E[Target environment<br/>python and platform markers] --> M
M[Marker-aware<br/>constraint model] --> S[Branch and bound search<br/>forward checking, arc consistency]
S --> R[Plan<br/>changes, cleared, open]
R --> V[Independent verifier]
R --> C[Deletion-based core<br/>for each open advisory]
C --> O[Open table<br/>reason or conflict chain]
V --> O
A plan assigns a version, or absence, to every package. It is valid when every direct requirement and every chosen version's requires_dist (markers evaluated for the target environment) is met, the chosen packages are exactly those reachable from the direct requirements, no yanked version is newly chosen and no pinned package is downgraded (unless --allow-downgrade). Valid plans are ordered by
- the number of advisories that affect the plan,
- the number of major-version bumps,
- the number of packages changed (added, removed or re-versioned),
- the total version distance (index distance in each package's sorted version list),
and then by the chosen versions in package-name order, so the optimum is unique. The search is depth-first backtracking with propagation, candidates ordered by distance from the current pin, and branch and bound on the objective.
For an advisory left open, the core is found by deletion. Start with every constraint plus the query "this advisory does not affect the plan", which is unsatisfiable. Drop constraints one at a time and keep each drop that leaves the set unsatisfiable. The set includes the solver's implicit rules (a yanked release may not be chosen, a locked package may not go down unless --allow-downgrade), so a core can name b 2.0 is yanked as the true blocker. What remains is a chain such as direct: yamlish<6 + DEMO-2026-0007: affected <6.0.1: remove any one member and the advisory becomes clearable.
python3 -m venv .venv && . .venv/bin/activate
pip install -e ".[dev]"
bumpplan demo # plan + verify on the bundled claims-api fixture
# the same thing with explicit inputs (bundled data lives in src/bumpplan/data)
D=src/bumpplan/data
bumpplan plan --lock $D/claims-api/requirements.txt --project $D/claims-api/pyproject.toml \
--index $D/index.json --advisories $D/advisories --python 3.12 --platform linux \
--write requirements.fixed.txt
bumpplan verify requirements.fixed.txt --project $D/claims-api/pyproject.toml \
--index $D/index.json --advisories $D/advisories
bumpplan explain DEMO-2026-0007 --lock $D/claims-api/requirements.txt \
--project $D/claims-api/pyproject.toml --index $D/index.json --advisories $D/advisories
pytestCommands: plan (add --json for machine output, --write to save the new pins), explain ADVISORY-ID, verify LOCKFILE (exit status 1 on any unsatisfied requirement, --fail-on-advisories to also fail on open advisories) and demo. Inputs are a pinned requirements.txt (hashes and index options ignored; -r, -c and -e lines are refused rather than skipped) or a PEP 751 pylock.toml, the [project].dependencies of a pyproject.toml, a JSON index {name: {version: {requires_dist: [...], yanked: bool}}} standing in for PyPI metadata, and a directory of OSV JSON files.
bumpplan demo, copied from a real run:
$ bumpplan plan (claims-api)
Plan for python 3.12, linux
Objective: 2 advisories open, 0 major bumps, 8 packages changed, version distance 16
Changes (8)
package from to bump clears
authlite 1.6.0 1.9.0 minor -
cloudcore 1.8.0 1.9.0 minor -
cryptobox 3.0.1 3.2.0 minor -
httpkit 3.0.1 3.0.3 patch DEMO-2026-0002
jwtcore 2.3.1 2.4.0 minor DEMO-2026-0005
pdfgen 4.0.0 4.1.0 minor DEMO-2026-0003
tmplengine 3.1.2 3.1.4 patch DEMO-2026-0001
urlpool 2.0.1 2.2.1 minor -
Cleared advisories (4): DEMO-2026-0001, DEMO-2026-0002, DEMO-2026-0003, DEMO-2026-0005
Open advisories (2)
advisory package version reason
DEMO-2026-0006 logfmt 1.2.0 no-fix-published
DEMO-2026-0007 yamlish 5.4.1 conflict
core (2): direct: yamlish<6 + DEMO-2026-0007: affected <6.0.1
# verify the planned pins (what `plan --write` saves, then `verify` on that file)
Verified 19 locked packages (python 3.12, linux)
No violations: every requirement is satisfied
Advisories affecting the lock (2)
DEMO-2026-0006 logfmt 1.2.0
DEMO-2026-0007 yamlish 5.4.1
# verify the naive upgrade: each affected package bumped alone
Verified 19 locked packages (python 3.12, linux)
Violations (3)
direct requires yamlish<6, but yamlish 6.0.1 is locked
authlite 1.6.0 requires jwtcore<2.4,>=2.0, but jwtcore 2.4.0 is locked
cloudcore 1.8.0 requires urlpool<2.1, but urlpool 2.2.1 is locked
Advisories affecting the lock (1)
DEMO-2026-0006 logfmt 1.2.0
The claims-api fixture plants one of each situation: a lone patch bump (tmplengine), a coupled bump (httpkit needs urlpool>=2.2, which needs cloudcore 1.9 because 1.8 pins urlpool<2.1), an advisory blocked by a direct requirement (yamlish<6), an advisory with no fix, a decoy (the newest pdfgen clears one advisory but sits inside another's range, so the plan takes the middle version), a win32-only requirement that must not constrain the Linux plan, a withdrawn advisory, a path choice (authlite 2.0 is one major bump; 1.9 plus two minor bumps is chosen), and a yanked urlpool 2.2.0 that the plan steps over. Running plan --platform win32 adds a ninth change, winpipe 1.2.0 to 1.3.0, because winpipe 1.2.0 requires urlpool<2.2.
- Lexicographic objective, with a unique optimum. Advisories first, then major bumps, then packages changed, then version distance. A weighted sum would let many small bumps outweigh one open advisory; the lexicographic order says what a security team means. Ties are broken by version indices in package-name order so that two runs, or two index files with different key order, produce the same bytes.
- Absence is a choice. A package that nothing requires any more is removed and counted as a change. The chosen set must equal the reachable set, which stops the solver from keeping orphans to avoid changes.
- Branch and bound over a SAT encoding. The instances are small and the objective is lexicographic, so a purpose-built search is simpler to audit than an encoding plus an optimiser. The bound sums per-package lexicographic minima (lexicographic order is compatible with addition), and advisories that touch several packages are only counted when every remaining candidate carries them. Branching starts with the packages that must change.
- Cores by deletion, not by solver internals. Deletion costs one satisfiability check per constraint but needs nothing from the search and yields a set that is irreducible by construction. An advisory that can be cleared alone, but only by opening another one, is reported as
trade-offwith the advisories it would open, because it has no core. - Independent verifier.
bumpplan.verifyshares no code with the solver: it walks the lock once and evaluates each requirement withpackagingdirectly. The tests run it on every plan, including the 200 random ones. - What counts as "published fix". A
fixedevent, or, forlast_affectedand explicit version lists, a later unaffected version in the index, in both cases counting only versions the plan may choose: yanked releases and (without--allow-downgrade) versions below the lock do not count. Without one the reason isno-fix-published, so a fix that exists only as a yanked release is reported that way instead of blaming a direct requirement, and downgrading below the first affected version is not offered as a fix.
Limits: a plan targets one Python version and one platform at a time, extras are not modelled, only ECOSYSTEM ranges and explicit versions lists of the PyPI ecosystem are read, and the index is a JSON file rather than live PyPI metadata.
pytest104 tests, all offline and deterministic: OSV range semantics (including property tests with hypothesis), lockfile and marker parsing, solver behaviour on hand-built worlds, the hand-derived claims-api plan, the other two fixtures, the CLI, and the two rigour checks. On 200 seeded random dependency graphs the solver's objective and plan equal exhaustive enumeration and every plan passes the verifier. For every open advisory with a core, in the fixtures and in the random instances, the core alone is unsatisfiable and removing any single member makes it satisfiable. fraud-score, the largest fixture (24 locked packages), plans in well under a second.
src/bumpplan/
env.py target Python and platform, explicit marker environment
osv.py OSV ECOSYSTEM range and version-list evaluation
index.py package index metadata (versions, yanked, requires_dist)
inputs.py requirements.txt, pylock.toml and pyproject.toml readers
solver.py objective, propagation and branch and bound
core.py deletion-based minimal unsatisfiable cores
planner.py plan report: changes, cleared and open advisories
verify.py independent lockfile checker
naive.py the one-at-a-time bump used for comparison
render.py text tables
cli.py Typer commands: plan, explain, verify, demo
testing.py seeded random instances and the exhaustive reference solver
data/ fictional index, 14 advisories, three service fixtures
tests/ pytest suite
MIT. See LICENSE.
