[Python-Dev] PEP 486: Make the Python Launcher aware of virtual environments

Paul Moore p.f.moore at gmail.com
Fri Feb 13 22:30:05 CET 2015


On 12 February 2015 at 19:44, Paul Moore <p.f.moore at gmail.com> wrote:
> Impact on Script Launching
> ==========================

Now that I'm looking into the details of the code for the launcher,
I've noticed that a shebang line of "#!/usr/bin/env python" will first
of all search PATH for a python executable, before falling back to the
default Python. This is *not* specified in PEP 397, although it makes
sense (as it parallels the behaviour in Unix).

Given that this behaviour exists, doing an explicit check for
VIRTUAL_ENV during shebang processing is unnecessary. The same effect
can be gained just by using "#!/usr/bin/env python" (it won't cover
the case of someone setting VIRTUAL_ENV but *not* adding it to PATH,
but that's no great loss).

I propose simply dropping this section of the PEP. I'll replace it
with a note explaining why it was dropped, and explaining the
behaviour of /usr/bin/env. Is that sufficient?

(By the way, on a procedural note, how do I update a PEP? Do I just
send an updated version to peps at python.org, or is there a better way?)

Paul


More information about the Python-Dev mailing list