[Python-Dev] Another update for PEP 394 -- The "python" Command on Unix-Like Systems

Nick Coghlan ncoghlan at gmail.com
Sat Feb 16 12:25:04 EST 2019


On Sat, 16 Feb 2019 at 09:19, Gregory P. Smith <greg at krypto.org> wrote:
> Not our problem?  Well, actually, it is.  Matthias speaking for Debian suggesting they don't want to have "python" at all if it isn't a synonym for "python2" because it'll break software is... wrong.  If software is not 3 compatible and uses "python", it'll also break when python is python3.  Just in a different manner.  "python" should point to python3 when a distro does not require python2 for its core.  It should not _vary_ as to which of 2.7 or 3.7 it will point to within a given stable distribution (installing python2.7 should never suddenly redirect it back to python2).  But "python" itself should always exist when any python interpreter is core to the OS.  That means if a distro no longer requires python2 as part of its base/core but does require python3... "python" must point to "python3".  If a posixy OS no longer requires python at all (surely there are some by now?) the question of what python should point to when an OS distro supplied optional python package gets installed is likely either "nothing at all" or ">=3.x" but should never be decided as "2.7" (which sadly may be what macOS does).
>
> Do we already have LTS _stable_ distributions making that mistake today?  If so they've done something undesirable for the world at large and we're already screwed if that distro release is deemed important by masses of users: There is no way to write a direct #! line that works out of the box to launch a working latest version Python interpreter across all platforms.

This is exactly why we want to change Fedora et al to have
/usr/bin/python aliased to /usr/bin/python3 by default, and yes,
having /usr/bin/python missing by default does indeed break the world
(search for Fedora 28 and Ubuntu 16.04 Ansible Python issues for
more).

While Matthias is still personally reluctant to add the alias for
Debian/Ubuntu, the *only* thing preventing aliasing /usr/bin/python to
/usr/bin/python3 right now on the Fedora & RHEL side of things is PEP
394, and Guido objected strongly when Petr last tried to get the PEP
to even acknowledge that it was reasonable for distros to make that
setting configurable on a system-wide basis:
https://github.com/python/peps/pull/630

For RHEL 8, the resolution was "Well, we'll ignore the upstream PEP,
then" and make the setting configurable anyway, but Fedora tries to
work more closely with upstream than that - if we think upstream are
giving people bad or outdated advice, then we'll aim to get the advice
changed rather than ignoring it.

In this case, the advice is outdated: there have been a couple of
years of releases with /usr/bin/python missing, so it's time to move
to the "/usr/bin/python3" side of source compatibility, and go back to
having "just run python" be the way you start a modern Python
interpreter, even when you're using the system Python on a Linux
distro.

Cheers,
Nick.

P.S. Note that we're not asking for the PEP to say "You should do
this..." - just for the PEP to acknowledge it as a reasonable choice
for distros to make given the looming Python 2 End of Life.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia


More information about the Python-Dev mailing list