-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
What is this?
This is a proposal to make pip
how pip --force-reinstall
works.
The difficulty here is this is current behaviour, and this would modify how pip works.
What is the problem?
Currently, when pip install [package-name] --force-reinstall
is executed, instead of reinstalling the package at the version previously installed, pip installs the package at the newest version available.
i.e. pip install [package name] --force-reinstall
acts as pip [package name] --upgrade
Using the Nielsen Norman good usability heuristics, this behaviour goes against #2: Match between system and the real world. This behaviour would be confusing to a new pip user.
What does pip
user guide say?
About --force-reinstall
the pip user guide says:
Reinstall all packages even if they are already up-to-date.
Replicate
See below:
testbox@testbox:/code/reinstall-test$ pip install click==5.0.0/code/reinstall-test$ pip install --force-reinstall click
Collecting click==5.0.0
Downloading https://files.pythonhosted.org/packages/af/55/056901e9f504a7cda9e955592360ce2c516b2b92f3da9318ba074be5d280/click-5.0-py2.py3-none-any.whl (65kB)
100% |████████████████████████████████| 71kB 441kB/s
Installing collected packages: click
Successfully installed click-5.0
osboxes@osboxes:
Collecting click
Downloading https://files.pythonhosted.org/packages/d2/3d/fa76db83bf75c4f8d338c2fd15c8d33fdd7ad23a9b5e57eb6c5de26b430e/click-7.1.2-py2.py3-none-any.whl (82kB)
100% |████████████████████████████████| 92kB 303kB/s
Installing collected packages: click
Found existing installation: click 5.0
Uninstalling click-5.0:
Successfully uninstalled click-5.0
Successfully installed click-7.1.2
Possible solutions
Best solution
When the user issues:
pip install [package name] --force-reinstall
they are prompted:
You had [package name] version [a.b.c] installed. Would you like to update to version [a.b.f]? Y/N
This solution would:
- make --force-reinstall behave as expected
- maintain previous behaviour if the user requested it
Minimum solution
When a user issues:
pip install [package name] --force-reinstall
[package name] is reinstalled at the version it was previously installed at.
Other solutions
- deprecate the --force-install
Next steps
Carry out a survey of pip users to get their understanding of what pip --force-reinstall does and should do, and what their opinions would be if the change to behaviour was made.
Based on a Zulip thread about about confusing current pip behaviour, we should audit the current pip commands to see they match the executed commands.
https://www.notion.so/simplysecure/Improve-the-CLI-structure-8238-d13ed2b1d0b64449b532cddd6df90a0e
Additional context**
Link to the discussion in Zulip.