pubgrub-rs / pubgrub

PubGrub version solving algorithm implemented in Rust
https://pubgrub-rs.github.io/pubgrub/pubgrub/
Mozilla Public License 2.0
337 stars 29 forks source link

Expose apis that allow implementing your own solver loop #231

Open konstin opened 3 weeks ago

konstin commented 3 weeks ago

In uv, we run our own solver loop (https://github.com/astral-sh/uv/blob/8596525d97e3e0d9b6981f7e122334bfc9f712c8/crates/uv-resolver/src/resolver/mod.rs#L317). This gives us async support, allows moving the solver into a thread, do advanced prefetching based on decisions, splitting resolutions on conflicting requirements for disjoint environments, etc.; overall we do it because we need that level of control with the complexity and performance requirements that uv has.

It would be great if uv would expose a dedicated set of types and methods to allow users to implement their own solver loop if they so choose. This interface comes with caveats, most notably that you have to uphold pubgrub's invariants about the order of operations yourself.