Warn on file conflicts when installing packages - #14249
Open
sepehr-rs wants to merge 1 commit into
Open
Conversation
Member
Author
|
The failing tests are caused by the warnings from |
Member
|
uv have been doing work on the same problem this year, and had to revert at least once due to user complaints. I will review the problems they had and if this will face the same issues. |
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What does this PR do?
Fixes #4625.
The approach taken here is to iterate over the installed distributions and track each RECORD entry in a dictionary, with the owning distribution as the value. Then, during
_install_wheel, each file path from the wheel is checked against this dictionary to determine whether another distribution already owns it. If so, the path is recorded and later included in a warning.However, the current approach only warns after the overwrite has already happened, which is not ideal. We could mitigate this by aborting the installation and requiring an explicit flag to continue, but unless we want to take a stricter approach, that may not be the best default behavior.
Another possible approach would be to prompt the user when conflicts are detected and require confirmation before proceeding. This is similar to aborting unless a flag is provided, but is more interactive and less strict.
Before going with any of the approaches above, though, I would like to get some input from the team on which one fits pip better. Please let me know if you have any ideas or suggestions on the implementation :).
Also, here is the output when installing two conflicting packages:
PR Checklist: