-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[issue 1548] Make pip install -e uninstall existing versions #1552
[issue 1548] Make pip install -e uninstall existing versions #1552
Conversation
by adding an additional call to `requirement.check_if_exists()` to RequirementSet.install Fixes pypaGH-1548
I just amended this because with my previous commit, it would not uninstall the previous version if you installed the new editable with a git URL -- e.g.: |
Ugh. The tests pretty much passed -- see https://travis-ci.org/pypa/pip/builds/18658167 The only problem is that the pypy build timed out with:
|
just noting that I see this. may not get the time to look at it til this weekend. |
Cool, thanks @qwcode! Let me know if you end up wanting tweaks, tests, squashing and rebasing, etc... |
@qwcode: Have you had a chance to look at this? |
@@ -876,6 +876,10 @@ def check_if_exists(self): | |||
return True | |||
else: | |||
self.satisfied_by = pkg_resources.get_distribution(self.req) | |||
|
|||
if self.editable and self.satisfied_by: | |||
self.conflicts_with = self.satisfied_by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I'd like to set self.satisfied_by
back to None after this.
and add a comment that says something like "when installing editables, nothing pre-existing should ever satisfy"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, see 5b62075. Thanks!
@qwcode: Thanks for the review. I'm AFK for a few days, but I'll try to try out the ideas you have here on Friday or so. |
Add a comment that says something like "when installing editables, nothing pre-existing should ever satisfy". Addresses @qwcode's comment at pypa#1552 (comment)
Addresses @qwcode's comment at pypa#1552 (comment)
@qwcode: Tried both of your suggestions and they seem to work -- see 5b62075 and 36cffa0. If you think that this is a sound change to make, we should probably write a test for this. Let me know -- I can try to take a stab at it. I'd love to have this change in pip -- I get a question probably at least twice a month that ends up with me telling someone to pip uninstall the offending library twice, because they got themselves into this state. |
Cc: @rlgomes |
I like it.! It would be nice indeed to not uninstall packages twice but I've been doing it for so long now, it's ingrained deep into my muscle memory. |
+1 On Sun, Feb 23, 2014 at 2:21 PM, Alexandre Conrad
<=> "If you don't know where you are, Dr. Edgar Spencer, Ph.D., 1995 |
Cc: @KaboomFox |
@msabramo can you add a test to for your editable/non-editable pair, you can use:
|
@carljm any historical memories on why editable installs don't uninstall previously existing non-editables? this PR would change that. |
I think warning that a package of the same name is already installed and stopping would be a less intrusive but still useful change. |
I think the only historical reason was that the presence (and accuracy) of the |
(Actually I may be wrong, maybe pip already has access to the |
currently, it is dependent on the correct |
I don't see this as intrusive, just what pip should be doing in the first place, to be consistent with other installs, although, I would prefer it not to be based on the egg fragment. |
Maybe a silly question, but why does pip require the |
I suspect it doesn't really, if we made modifications, but see #1289 for discussion. |
See 3e0d727, which adds a new test called
Question: Why do other tests in |
I don't really have much opinion on it myself. I'm not against it going in, but I've not looked at it closely enough that I'd be willing to merge it myself. One thought. All other installs require |
This PR makes total sense to me, so +1 👍
When This is why I think this PR makes absolute sense and that it should be merged. |
To say again, the hold on this from me at the time wasn't about whether the idea in general makes sense. It does make sense. The concern was that for vcs installs, it would work based solely on the But, otoh, incremental improvement is also a good argument. at least, add something to the vcs docs explaining the situation. https://pip.pypa.io/en/latest/reference/pip_install.html#vcs-support |
A doc update? Love it! :) @msabramo would you mind adding some clarification in the docs about the expectations with regards to the |
Yeah I can take a stab at docs later |
I'm AFK today so if anyone feels like taking a stab at docs, be my guest. |
@msabramo reminder, I'm willing to merge with docs updates |
Thanks it indeed fell off my radar. Will try to update with docs this week. |
result.assert_installed('pip-test-package', with_files=['.git']) | ||
assert 'Found existing installation: pip-test-package 0.1' in result.stdout | ||
assert 'Uninstalling pip-test-package:' in result.stdout | ||
assert 'Successfully uninstalled pip-test-package' in result.stdout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, would be better if you could confirm the package is removed from site-packages using result.files_deleted
as for docs, thinking we'd need a few lines added to https://pip.pypa.io/en/latest/reference/pip_install.html#editable-installs to explain what will happen, and especially that vcs will work based on the |
Accidentally closed this, reopening. Sorry! |
Hello! As part of an effort to ease the contribution process and adopt a more standard workflow pip has switched to doing development on the If you do nothing, this Pull Request will be automatically closed by @BrownTruck since it cannot be merged. If this pull request is still valid, please rebase it against If you choose to rebase/merge and resubmit this Pull Request, here is an example message that you can copy and paste:
|
This Pull Request was closed because it cannot be automatically reparented to the Please feel free to re-open it or re-submit it if it is still valid and you have rebased it onto |
Any news on this? When deploying systems i randomly hit this situation with cronjobs. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
by adding an additional call to
requirement.check_if_exists()
toRequirementSet.install
.Fixes GH-1548
Example output with this PR:
Note that when I do
pip install -e
on requests above, the previous version gets found and uninstalled.Cc: @sontek, @aconrad, @whitmo