sarugaku / resolvelib

Resolve abstract dependencies into concrete ones
ISC License
138 stars 31 forks source link

Fix backjumping by checking if broken_state.mapping is empty #152

Closed notatallshaw closed 2 months ago

notatallshaw commented 2 months ago

Fixes https://github.com/sarugaku/resolvelib/issues/134

Still need to provide a test, going to see if I can write a small provider that can process the JSON in https://github.com/sarugaku/resolvelib/issues/134#issuecomment-2164347177 and follows pip's preference logic.

But feedback would be welcome.

notatallshaw commented 2 months ago

Upon writing a test case I realized it wasn't sufficient to check if name is in incompatible dependencies, but the simpler check of checking if broken_state.mapping is empty is sufficient.

notatallshaw commented 2 months ago

Actually, while this solves the given test case, I found it still fails for "kedro[test]==0.18.13".

I am going to leave this PR as ready to review, because I still beleive it's correct to exit from backtracking when broken_state.mapping is empty.

But I am going to try and create another minimal example from "kedro[test]==0.18.13".

notatallshaw commented 2 months ago

I found it still fails for "kedro[test]==0.18.13"

After a bit of investigation I found that this is probably an edge case related to extras. I am investigating further, but it could be an issue on pip side. I plan to make a separate issue once I have found a simple reproducer. I would like this PR to be treated as solving the original example in https://github.com/sarugaku/resolvelib/issues/134