Skip to content

Add conflict driven priority reordering when backtracking#13859

Merged
notatallshaw merged 2 commits intopypa:mainfrom
notatallshaw:conflict-priority-simple
Mar 22, 2026
Merged

Add conflict driven priority reordering when backtracking#13859
notatallshaw merged 2 commits intopypa:mainfrom
notatallshaw:conflict-priority-simple

Conversation

@notatallshaw
Copy link
Member

If candidate packages are regular involved in a conflict they are promoted to being resolved first.

This makes significant performance improvements in many scenarios, e.g.

# On Python 3.12: ResolutionTooDeep -> 586 resolution rounds
pip install --dry-run --uploaded-prior-to "2025-11-17" 'trustllm'

# On Python 3.10: Build Failure -> Success
pip install --dry-run --uploaded-prior-to "2024-10-23" 'numpy==1.21.5' 'spacy<4.0.0,>=3.0.0' 'mlflow<3.0.0,>=2.13.0'

# On Python 3.10: 1257 resolution rounds -> 473 resolution  rounds
pip install --dry-run --uploaded-prior-to "2023-12-10" 'kedro[test]==0.18.13'

I could not find any examples where this made performance worse.

@notatallshaw
Copy link
Member Author

FYI @frostming I assume this exact optimization can be applied to PDM. Also I plan to bring some bigger optimizations soon, probably to resolvelib.

@notatallshaw notatallshaw merged commit 59555f4 into pypa:main Mar 22, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants