[Python-Dev] PEP 394 update proposal: Allow changing the `python` command in some cases
Petr Viktorin
encukou at gmail.com
Wed Apr 25 15:10:10 EDT 2018
Hello,
In Fedora, I found that PEP 394's strict recommendation that `python`
points to `python2` is holding us back. From discussions on Zulip and
elsewhere it's clear that this recommendation is not changing any time
soon, but I would like to officially relax it in several cases.
The problems are:
- For developers that are not following the language's development, the
fact that `python` invokes `python2` sends a strong signal that 2 is
somehow the preferred version, and it's OK to start new projects in it.
- Users and sysadmins that *do* want to “live in the future” are
switching the symlink to `python3` themselves. We would like to give
them a supported, documented way to do so -- and make surer they're
aware of the caveats.
- The `python` command is still not available out-of-the box on macOS,
so it didn't completely live up to the expectation of being the
cross-platform way to launch 2/3 source compatile scripts.
- `python` in the shebang line can mean *either* that a script is
carefully written to be 2/3 compatible, *or* that the author/maintainer
is lazy or unaware of the recommendations. While Fedora guidelines have
long banned the unversioned command, we feel that the only way to
*enforce* that guidelines is to provide environments where the `python`
command does not work (unless explicitly installed).
To help solve these, I would like to relax recommendations on the Unix
``python -> python2`` symlink in these cases:
- Users and administrators can, by a deliberate action, change
``python`` to invoke Python 3. (Activating a venv counts as such an
action, but so would e.g. using alternates, installing a non-default
overriding package, or replacing /usr/bin/python.)
- In controlled environments where being explicit is valued more than
user experience (test environments, build systems, etc.), distributions
can omit the `python` command even when `python2` is installed.
I have filed these changes as a pull request here:
https://github.com/python/peps/pull/630
The PR also spells out several other things, which I felt were hidden
between the lines -- but correct me if you disagree with my reading.
More information about the Python-Dev
mailing list