Skip to content

Adopting "working" scheme for every run #4575

Open
@pradyunsg

Description

@pradyunsg

Just carrying over my idea in #1056 (comment), 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:

/ping @dstufft @pfmoore

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: user schemeHandling of packages in user-specific directoriesUXUser experience relatedstate: awaiting PRFeature discussed, PR is neededtype: enhancementImprovements to functionalitytype: refactorRefactoring code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions