Use explicit version of Python 2/3 throughout Fedora
Summary
Currently, in Fedora package names, executables etc., python
without a version number generally means Python 2. Given that the upstream support for Python 2 will end soon, we want to prepare Fedora for a transition to Python 3. Before switching python
to refer to Python 3, we need to free it of the current meaning of Python 2. This means explicitly using either "python2" or "python3" throughout Fedora.
This Fedora change is "Phase 1" of a long-term effort described in Finalizing Fedora's Switch to Python 3 transition plan.
Owner
- Name: Iryna Shcherbina
- Name: Miro Hrončok
- Name: Petr Viktorin
- Email: python-maint at redhat.com
- Release notes owner:
Current status
- Targeted release: Fedora 28
- Last updated: 2018-01-05
- Tracker bug: <will be assigned by the Wrangler>
Detailed Description
This Change covers:
- Renaming Python 2 binary RPMs from
python-foo
topython2-foo
This is already partially done by applying automated patches as announced in Mass package change (python2- binary package renaming). The packages which still need to be fixed are tracked in PortingDB.
- Fixing ambiguous Python 2 dependency declarations, i.e using
python2-foo
instead ofpython-foo
in requirements
We have started opening automatic Pull Requests with patches as announced in Mass Pull Request filing for ambiguous Python 2 requirements. The packages which will be targeted are tracked in PortingDB (at this point, most of these fail to build due to unrelated problems).
- Start ensuring that
/usr/bin/python
or/usr/bin/env python
shebangs are replaced with either/usr/bin/python2
or/usr/bin/python3
This is currently covered by a Taskotron check. We will provide a macro to do this automatically, and help packagers do the change.
Each of the above conforms to the Python packaging guidelines as approved by FPC. The work on the change is already in progress and will be tracked by this Fedora change.
Benefit to Fedora
This transition plan will simplify the final transition to Python 3 when the upstream support for Python 2 ends.
Fedora has long been a one of the leaders of the Make Python 3 the Default Python initiative, having Python 3 as the "default Python" since Fedora 23 including a Fedora Workstation without Python 2, tracking the status of Python 3 compatibility and actively getting involved in porting upstream projects, such as (but not limited to) Samba. However, there are other distros (such as Arch) where python
means Python 3 for quite some time.
Scope
- Proposal owners:
Proposal owners are to communicate the idea to the packagers and rename the affected packages as well as fix the requirements via Mass_package_changes procedure.
- Other developers:
Package maintainers are expected to fix package requirements generated from shebangs by making sure that no scripts in their packages use /usr/bin/python
or /usr/bin/env python
shebangs.
Package maintainers will also be asked to review Pagure PRs with automated patches fixing the ambiguous Python 2 dependency declarations.
- Release engineering: #Releng issue number (a check of an impact with Release Engineering is needed)
- List of deliverables: N/A (not a System Wide Change)
- Policies and guidelines:
- Using python2/python3 instead of python in binary RPM package name guidelines, fpc (already in effect)
- Using python2/python3 instead of python in (Build)Requires, guidelines, fpc (already in effect)
- Using
/usr/bin/python2
instead of/usr/bin/python
in shebangs and Requires, guidelines, fpc (already in effect)
How To Test
We have implemented taskotron checks for these changes. The checks are being run each time a Python package is build in Koji, and you may view the results in taskotron resultsdb or when you submit the update in Bodhi.
Dependencies
None
Contingency Plan
- Contingency mechanism: All changes are incremental. If a part of the Change is not completed in time, it will be moved to the next Fedora release.
- Contingency deadline: beta freeze
- Blocks release? No
- Blocks product? No
Documentation
- FinalizingFedoraSwitchtoPython3
- Discussion on Fedora devel mailing list
- Mass package change (python2- binary package renaming), part 1
- MASS CHANGE announcement: python2- prefix renaming, part 2
- Mass Pull Request filing for ambiguous Python 2 requirements.
Release Notes
TBD