Adopting "working" scheme for every run
See original GitHub issueJust carrying over my idea in https://github.com/pypa/pip/issues/1056#issuecomment-218130183, for proper dedicated discussion.
AFAIK, there are 3 possible schemes for packages:
- “system” - for system/global packages (
--system
)- “user” - for packages installed in user space (
--user
)- “local” - for virtualenv packages (
--local
)pip enforces a “working” scheme on every run. Outside a virtualenv, the default working scheme would be “system” (It should really be “user”, that’s another issue #1668). Inside a virtualenv, the default working scheme should be “local”. Passing
--system
or--user
or--local
overrides the working scheme.Only packages in the same scheme as the working scheme can be modified. By modifying, I mean installing or uninstalling a package. Trying to modify a package in a different scheme is not allowed and pip would print a message and error out.
So, modifying a package in system scheme with a “user” working scheme is not allowed. Nor is modifing a package in user scheme with a “system” working scheme. Niether are the other permutations with “local”.
I think this results in a pretty simple behaviour model.
As @ncoghlan pointed out, this would need some logic to understand that user installs shadow system ones. Also, I would slightly change this to spell it like --scheme {global,user,venv}
because I like how this signifies exclusiveness of the behaviours better than plain flags do and is consistent with some internal configuration stuff.
Additionally, while doing this:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:26 (19 by maintainers)
How does
--target
mode of operation relate to schemes? It feels like--target
essentially is another type of scheme and treating it as such would potentially solve many bugs pertaining to--target
option.I personally think that fallback logic is too complicated. If you’re operating under a badly configured distro, use virtualenv.