Fedora mulls its "python" version
There is no doubt that the transition from Python 2 to Python 3 has been a difficult one, but Linux distributions have been particularly hard hit. For many people, that transition is largely over; Python 2 will be retired at the end of this year, at least by the core development team. But distributions will have to support Python 2 for quite a while after that. As part of any transition, the version that gets run from the python binary (or symbolic link) is something that needs to be worked out. Fedora is currently discussing what to do about that for Fedora 31.
Fedora program manager Ben Cotton posted a proposal to make python invoke Python 3 in Fedora 31 to the Fedora devel mailing list. The proposal, titled "Python means Python 3", is also on the Fedora wiki. The idea is that wherever "python" is used it will refer to version 3, including when it is installed by DNF (i.e. dnf install python) or when Python packages are installed, so installing "python-requests" will install the Python 3 version of the Requests library. In addition, a wide array of associated tools (e.g. pip, pylint, idle, and flask) will also use the Python 3 versions.
The "Requests" link above does point to a potential problem area, however.
It shows that Requests for Python 3 III is not fully finished, with an
expected release sometime "before PyCon 2020
" (mid-April
2020), which is well after the expected October 2019 release of
Fedora 31. The distribution already has a python3-requests
package,
though, so
that will be picked up as python-requests in Fedora 31 if
this proposal is adopted. There may be other packages out there where
Python 3 support is not complete but, at this point, most of the major
libraries have converted. [Update: As noted in the comments, this paragraph is based on complete confusion about the version numbers of Requests.]
The proposal is owned by Miro Hrončok and Petr Viktorin, who work on the Python team at Red Hat. Viktorin presented at the 2016 and 2018 Python Language Summits on the problems inherent in the transition to Python 3 for distributions. Both have also been involved in reworking the recommendations that the Python core development team provides to distributions. Those are contained in PEP 394 ("The 'python' Command on Unix-Like Systems"). The rework consists of loosening those guidelines to allow distributions to choose Python 3 for their python; it has garnered the support of the Python steering council.
One of the concerns about the proposal is the specter of another similar
transition for Python down the road. As "stan" put
it: "Wouldn't this mean that when python4 is released, there is a
replay of
the python2 -> python3 transition experience?
" But Hrončok pointed
out that the packages are not being renamed, just that unadorned
"python" will resolve to "python3"; shebang ("#!") lines for Python code
shipped in packages will need to directly
invoke python3, not simply python.
That led Cotton to wonder what the advantage of having the unadorned "python" was; why couldn't there simply be python3 (and python2 if it is installed)? Hrončok noted that users attempting to use Python on Fedora systems might find the following sequence to be suboptimal:
$ python
bash: python: command not found
Oh right!
$ sudo dnf install python
No match for argument: python
Error: Unable to find a match
Oh well?
He continued: "Fedora is equipped with fully operational, ready to
use and develop on
Python interpreter, why not let people find it?
" He also pointed
out that the upstream Python team was not pushing for this change, but
simply allowing for the possibility. Fedora could still decide to not have
a python and it would not run afoul of the recommendations. But
he strongly suggested that, in any case, python no longer point to
Python 2
(even though that would not run afoul of the recommendations either).
The idea of having no python was not particularly popular. Administrators could make that happen on their systems, if they wished, or point python to Python 2 for that matter. But, as Gerald Henriksen put it:
In answer to a question
from Adam Williamson, Hrončok said that the reasoning for making the change for Fedora 31 was
mostly due to the dates involved, as the
proposal describes: "The name 'Python' will not refer to software
that will be unmaintained
upstream for most of Fedora 31's lifetime and retired from Fedora
32.
" The latter piece refers to the plan to
stop shipping Python 2 as python2 in Fedora 32. A
legacy python27 package will be created (and may be allowed as a
dependency for a small number of packages).
Zbigniew Jędrzejewski-Szmek asked about perhaps postponing the proposed change to Fedora 32 as well:
Stephen John Smoogen thought that having a release with no python at all would be useful to suss out packages that have still not fixed their shebang lines and such. But Michael Catanzaro said that not having a /usr/bin/python would wreak havoc for software that needs to run on both Linux and macOS, such as WebKit.
Others will also want to be able to simply use #!/usr/bin/python in their scripts. The distribution can pick a particular version to target in its scripts, but users may have different agendas. Mátyás Selmeci said:
There was a fair amount of discussion but pointing python to Python 3 seems like a relatively uncontroversial move. There really wasn't any impassioned argument against it, which is perhaps a little surprising. But Fedora has been moving steadily down the path to retiring Python 2 more or less in lockstep with the Python core developers. One wonders when it will get to the point that legacy Python 2 users will have to get their interpreter from outside of Fedora entirely—maybe by 2025?
| Index entries for this article | |
|---|---|
| Python | Linux distributions |