-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
pip-sync will happilly uninstall all packages if requirements.txt is empty #671
Comments
Seems like pip-sync is doing the right thing to me. Always check the input to your programs before you run them. |
Heh, since I wrote this PR I ended up liking this behavior and started using My concern when filling this PR was using |
Why not check the previous file with another tool like |
I think we can ask if a user wants to continue. For example: if file_is_empty and not click.confirm('Do you want to uninstall all packages?'):
sys.exit(0) |
Personally I'm against training users that commands can't do something dangerous. They'll get a shock when Another concern is what if I really do want to do this? We'll need another option like |
That makes sense. But I don't mind honestly, for I remember how I got myself into this trap once and deleted all packages in the env. |
Uninstalling all packages is exactly what I expect and desire to happen when I |
A nicer option would be to add an "opt-in" feature, ie. an I think |
I'll close this based on the above which was implemented in #913, but please let us know if it doesn't resolve your issue. Thanks! |
This perhaps might be argued to be a feature, since
pip-sync
supposed to uninstall anything that is not inrequirements.txt
but this is dangerous in scenarios when an earlier operation has failed and causedrequirements.txt
to be empty. I'm wondering whether this safety measure could be added, if someone needs the behavior, maybe they can specify--force
?Environment Versions
$ python -V
: N/A$ pip --version
: 18.0$ pip-compile --version
: 2.0.2Steps to replicate
Expected result
Operation would fail
Actual result
All packages were uninstalled
The text was updated successfully, but these errors were encountered: