PEP 832: virtual environment discovery

Which one? You have at least 2:

and

I think you’re talking about the first one based on other things you said in the post, but I want to be clear first before potentially taking this conversation in another direction.

I disagree based on one of the key motivators for me bothering with this PEP. When I was the dev manager for the Python extension for VS Code, we got 2 constant complaints: “why can’t you find my environment?”, and “why is start-up slow?”. The former led to the Python environments extension and providing an API for other extensions to use to provide such details.

The perf issue is supposed to be addressed by this PEP. Now you may be asking why knowing the location is important for this? Well, some workflow tools are not exactly fast at listing all of their available environments (and I will not name-and-shame them publicly, so please don’t ask). Tack on users who have environments in the hundreds (and that’s not an exaggeration), and slow workflow tools can lead unacceptable start-up or on-demand listing their workflow tools. For VS Code we had to come up with our own caching, asynchronous refreshing of that cache, having a way to forcibly refresh, etc.

So hopefully that helps explain why I don’t think knowing where an environment is kept is an anti-pattern. :wink:

I need to know where it is on disk to read the source for auto-complete after providing users a list of environments to choose from (after going with the default so I don’t have to bother them by asking).

You also forgot about my patience and time. :wink: I’m obviously willing to talk things out, but I am only willing to for so long before I either go ahead with the PEP or walk away entirely.

And to think this was supposed to be the “easy” workflow PEP for me.

It’s an interesting idea!

Except if the majority don’t bother then we end up like PEP 708 and being rejected 3 years after acceptance due to lack of uptake.

That’s good to hear! That at least suggests to me that the idea isn’t infeasible.

There’s also PEP 621 which added the [project] table. I’m also an author of that PEP and another one you listed, so I’m aware of the lack of hard definition of “project”. :grin:

I would invert that and say the environment marker goes where you consider your project root. So the .venv file is not defining where a “project root” is, it’s the other way around.

I’m not going to make any promises about changing it, but I will think about it (and if anyone else has an opinion they can speak up).

Based on what @bernatgabor has told me, some tox users have defined a “dev” environment in their tox config for this sort of thing.