I tried to look up sys.real_prefix and discovered that that property is not present in the sys docs or the CPython code base. Recommending injecting a new attribute into a stdlib module seems like a very questionable thing to do, so I’d much prefer that that be removed from PEPs 668 and 704, or at least a disclaimer added that that is a legacy virtualenv thing and should not be used by other tools.
That seems like a reasonable set of options. There’s two question marks I think:
- Rolling out such a change is nontrivial. You’ll have a mix of Python version with/without a patch, and Pip versions with/without the changed behavior. That’s bound to not go smoothly.
- (2) is probably not solving anything. If there would be any “trampling” it’s because two package managers are trying to (un)install different versions of the same package. Ignoring the actual problem there and letting them both install a version of the package in different directories will lead to more problems than it solves probably. What version is going to be preferred? Which package manager now ends up with incorrect metadata? etc.
- The correct solution is probably to either error out with an informative message, or let the two package managers cooperate so we end up with the correct version of the package in question (hard).