To be up front, I would personally love it if everyone always used some form of environment isolation mechanism when installing Python packages (at least in typical, non-container, use cases with pip and conda) or other given the countless hours of my life that I would save helping others solve the issues that resulted when they didn’t do this. That said, at this point, I’m currently undecided as to my feelings on the central approach of this PEP.
A couple big questions:
How would Conda deal with this? If installers don’t detect Conda environments being activated (as pip currently doesn’t, last time I tested enabling pip’s implementation of this), this means that any installer that implements this PEP will not work by default with Conda (unless Anaconda/Conda-Forge patches the relevant versions of that installer, and users are using a Conda-patched version, which sometimes they are and sometimes they aren’t).
On top of the base level of user frustration this would likely cause by users having to figure out how to bypass this (assuming they even can in all cases, which the PEP now does not require, and the mechanism may not always be accessible in all contexts). If people get a pip
error in a conda env that they need to active a venv and follow the mandated
shell-specific instructions on how to create and activate a virtual environment named .venv
now they are going to have a separate venv activated inside their conda env, which is a sure recipe for chaos and confusion.
Also, wrt virtual environment directory names, I’m all in favor of standardization on this front, at least in terms of giving unnamed venvs (i.e. for which their enclosing directory namespaces them from all other venvs) a standardized name, as the current hodge-podge of conventions is maddening and makes things complicated for users (and everyone else) for no benefit. However, there are two drawbacks to consider when considering this vs. named venvs, i.e. venvs that have a meaningful specific name:
- This means only one venv can be placed in a given directory, which may or may not interoperate with existing centralized management approaches, as now all conforming venvs will need a unique parent directory too. I’m not sure how much of an impact this may have on existing tooling that uses this approach, as I’m not too familiar with it (I mostly use either conda or add-hoc venv management).
- The name of the venv directory is what is shown as part of the prompt when the venv is activated. For me, this is the key reason I give my venv directories unique names, giving me an instantly visible confirmation of what venv I’m in. While this PEP protects against installing outside a venv, this would make it much easier to install/uninstall in the wrong venv, which is something I got bitten by several times before I adopted unique venv names.
I’ve also reviewed the PEP from a PEP editor perspective, including a handful of comments regarding the PEP clearly and precisely expressing what it intends to in terms of terminology and rationale, that may stray a bit into the gray area of content/subject matter expertise. If you feel any of them stray too far, I can defer them and bring them up here instead.