I have to admit ambivalence about this PEP. Conceptually, I think it would be nice to have more built-in default support for venvs, effectively almost always running Python or your script(s) out of a venv. I’m just not sure what that should look like. I also get that it can be difficult to connect your IDE/editor to a venv with the tools and code in it that it needs.
All that said, I’m not sure that this PEP gives me much improvement over my own workflows, as Paul says. Thinking about how I use venvs these days, I create them explicitly less often than in the past, and when I do, it’s very often ephemeral venvs that I abandon or delete after some quick experiment is done.
When I’m working on a project of mine, of course I use venvs, but not just one, but many, e.g. one for each Python version in a support matrix that my library supports. Fortunately, I tend to use hatch when I get a choice, and it does a really good job of managing my venvs for me. And because I will run commands through hatch, it pretty much manages which venv it will use for whatever tasks I need to do, e.g. build the docs, run the linter/typechecker/autoformatter, run the tests in PythonX.Y, etc. But there, I just name the venv I want to use instead of specifying the exact path or activating it. Very rarely do I explicitly activate a hatch-maintained venv, although it does happen, e.g. if I want to run some odd pytest combination in a specific version of Python.
Instructive to me is hatch’s support for venv storage location and the discussion about whether venvs go in the project or not. I feel pretty strongly that even if your venvs for a project live in the project directory, they aren’t part of the project. I don’t want to impose any venv-location choices on the contributors to my project because I think that’s a purely personal choice. As such, while for a while I was setting hatch’s [dirs.envs] because the default location on macOS is tricky to get to, I’ve ended up just letting the default do its thing and not worrying about it. Something like:
% source "$(hatch env find)/bin/activate"
works well enough for me in the rare case that I need it.
I have similar feelings about using uv run --script in a shebang. I know uv creates a venv somewhere, installs the PEP 723 metadata dependencies, and runs my script, but the details are mostly unimportant and hidden from me.
I just keep wondering if python or py could grow similar functionality, essentially just uv run + PEP 723 + perhaps [tool.uv.sources]? Mostly I just want things to run under a venv and almost never even care or notice, but for there to be a way to more easily activate a venv wherever it is in the rare case that I need it. Of course, along with that has to come venv management such as removing/pruning.