From Fedora Project Wiki
Line 54: Line 54:
This will also require revisiting Python guidelines (broader discussion with community and FPC approval - TBD). The result of the discussion will reflect in this feature in further instructions for Fedora packagers.
This will also require revisiting Python guidelines (broader discussion with community and FPC approval - TBD). The result of the discussion will reflect in this feature in further instructions for Fedora packagers.


Work needed to be done:
There are basically two types of packages that need to undergo the conversion:
* Python extension modules and libraries that provide Python bindings - assuming that there is upstream support, these can recieve python3- subpackage anytime without any damage to Fedora; we can then just utilize this subpackage when switching to Python 3 (instead of using current python- subpackage).
* Packages that build with some sort of "embedded Python support", like gdb, or Rhythmbox with its plugins. In these cases, it makes no sense to do a python3- subpackage, since the whole package would need to be duplicated (e.g. python3-gdb), which doesn't make sense. These packages should be tested with Python 3 locally without any modifications to how they're currently built in Fedora. When we get a Koji side-tag, these packages will switch and build against Python 3 in the side tag.


=== Work in Fedora 21 Timeframe ===
* Proposal owners:
* Proposal owners:
<!-- What work do the feature owners have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
** Discussing changes in Python packaging guidelines with Fedora community and FPC
** Discuss changes in Python packaging guidelines with Fedora community and FPC
** Helping upstreams with porting to Python 3
** Help various upstreams with migration to Python 3 (already in progress for some time)
** Introducing python3- packages where appropriate, testing packages that only build with Python once (e.g. gdb, Rhythmbox)
** Help other packagers with introduction of python3- subpackages


* Other developers:
* Other developers:
<!-- What work do other developers have to accomplish to complete the feature in time for release?  Is it a large change affecting many parts of the distribution or is it a very isolated change? What are those changes?-->
** Hopefully the same as proposal owners.
** Packagers who own a package that uses Python in any way should make sure that it works with Python 3:
*** If the package works with Python 3, they should add python3- subpackage where appropriate.
*** For some packages that build with Python, like gdb or Rhythmbox, doing python3- subpackages makes no sense. Packagers should only make sure that the packages work with Python 3. There should a single point, at which all these packages will be rebuilt with Python 3, possibly in a Koji side tag.
*** If the package doesn't work with Python 3, packagers should encourage upstreams and send patches.


* Release engineering:
* Release engineering:
<!-- Does this feature require coordination with release engineering (e.g. changes to installer image generation or update package delivery)?  Is a mass rebuid required?  If a rel-eng ticket exists, add a link here.  -->
** Nothing in F21 timeframe
** We will use a side tag in Koji and merge it to rawhide only if everything works as expected.


* Policies and guidelines:
* Policies and guidelines:
<!-- Do the packaging guidelines or other documents need to be updated for this feature?  If so, does it need to happen before or after the implementation is done?  If a FPC ticket exists, add a link here. -->
** As mentioned above, this will require a discussion with community and FPC and alteration of Python packaging guidelines.
** As mentioned above, this will require a discussion with community and FPC and alteration of Python packaging guidelines.


=== Work that should be done for Fedora 21 ===
=== Work in Fedora 22 Timeframe ===
For Fedora 21, we should focus on helping upstreams with porting to Python 3 and we should introduce python3- subpackages where appropriate. No other changes should be done during this timeframe.
* Proposal owners:
** Continue the work from F21 timeframe
** Request Koji side-tag and encourage packagers to rebuilt their packages with Python 3 there
** If the switch to Python 3 is achieved in the side-tag:
*** Modify comps accordingly
*** Apply the changes to Python packaging guidelines
*** Ask relengs to merge the side tag into F22
** Else:
*** Postpone the Change for another release
*** Do not merge side tag into F22
*** Do not apply changes to Python packaging guidelines
 
* Other developers:
** Introduce python3- subpackages where appropriate, build against Python 3 in the side tag where appropriate
 
* Release engineering:
** Create the Koji side tag
** Merge the side tag back in the switch is achieved
 
* Policies and guidelines:
** Apply the changes to Python guidelines if the switch is achieved


== Upgrade/compatibility impact ==
== Upgrade/compatibility impact ==

Revision as of 07:21, 4 October 2013

Python 3 as Default

Summary

Up until now, Fedora has used Python 2 as a default Python implementation. This change proposes switching to Python 3. The term "switching" is explained in detail in Scope section.

Owner

  • Name: Slavek Kabrda
  • Email: bkabrda@redhat.com
  • Release notes owner:

Current status

Detailed Description

Python 3 is the next generation of Python programming language. It is currently mature and stable, since it has been under active development for five years - 3.0 was released in December 2008, current latest stable version is 3.3.2 released in May 2013. The reasons why to switch to Python 3 as a default are mentioned in #Benefit to Fedora section, possible issues in #Scope. This feature assumes that DNF will be the default package manager in F22, as Yum doesn't and never will work with Python 3. If DNF doesn't make it to Fedora 22, this feature has to be postponed accordingly.

Benefit to Fedora

Python 2.7 (latest Python 2 release, which we also have in Fedora) is currently in maintenance mode only, which means upstream only accepts bugfixes and security fixes, but no new features are being implemented. According to upstream, Python 2.7 is the last release of Python 2 (http://www.python.org/dev/peps/pep-0404/). Support for Python 2 is guaranteed by upstream until May 2015 (http://www.python.org/dev/peps/pep-0373/#maintenance-releases), then it may continue for some time or it may not. Python 3, on the other hand, is actively developed and new features are being added every release.

Fedora already has Python 3 stack, that is parallel to Python 2 stack. The are few benefits of switching the "primary" Python stack:

  • Getting upstream support is not limited by time.
  • Our system tools will be able to switch to Python 3, drop Python 2 support and use new features of Python 3.
  • As a distribution that stays close to upstream, Fedora should help Python community go forward by contributing patches and working closely with upstreams to get this accomplished. Thus this Change is meant to benefit not only Fedora, but also broad Python community.
  • Pushing Python 3 as a default in Fedora should improve perception of Python 3 as a mature language and speed up adoption by upstreams.

Scope

The main goal is switching to Python 3 as a default, in which state:

  • DNF is the default package manager instead of Yum, which only works with Python 2
  • Python 3 is the only Python in minimal buildroot
  • Python 3 is the only Python on LiveCD
  • Anaconda and all of its dependencies run on Python 3
  • cloud-init and all of its dependencies run on Python 3

(see Dependencies for the list of packages that need to be ported)

This will also require revisiting Python guidelines (broader discussion with community and FPC approval - TBD). The result of the discussion will reflect in this feature in further instructions for Fedora packagers.

There are basically two types of packages that need to undergo the conversion:

  • Python extension modules and libraries that provide Python bindings - assuming that there is upstream support, these can recieve python3- subpackage anytime without any damage to Fedora; we can then just utilize this subpackage when switching to Python 3 (instead of using current python- subpackage).
  • Packages that build with some sort of "embedded Python support", like gdb, or Rhythmbox with its plugins. In these cases, it makes no sense to do a python3- subpackage, since the whole package would need to be duplicated (e.g. python3-gdb), which doesn't make sense. These packages should be tested with Python 3 locally without any modifications to how they're currently built in Fedora. When we get a Koji side-tag, these packages will switch and build against Python 3 in the side tag.

Work in Fedora 21 Timeframe

  • Proposal owners:
    • Discussing changes in Python packaging guidelines with Fedora community and FPC
    • Helping upstreams with porting to Python 3
    • Introducing python3- packages where appropriate, testing packages that only build with Python once (e.g. gdb, Rhythmbox)
  • Other developers:
    • Hopefully the same as proposal owners.
  • Release engineering:
    • Nothing in F21 timeframe
  • Policies and guidelines:
    • As mentioned above, this will require a discussion with community and FPC and alteration of Python packaging guidelines.

Work in Fedora 22 Timeframe

  • Proposal owners:
    • Continue the work from F21 timeframe
    • Request Koji side-tag and encourage packagers to rebuilt their packages with Python 3 there
    • If the switch to Python 3 is achieved in the side-tag:
      • Modify comps accordingly
      • Apply the changes to Python packaging guidelines
      • Ask relengs to merge the side tag into F22
    • Else:
      • Postpone the Change for another release
      • Do not merge side tag into F22
      • Do not apply changes to Python packaging guidelines
  • Other developers:
    • Introduce python3- subpackages where appropriate, build against Python 3 in the side tag where appropriate
  • Release engineering:
    • Create the Koji side tag
    • Merge the side tag back in the switch is achieved
  • Policies and guidelines:
    • Apply the changes to Python guidelines if the switch is achieved

Upgrade/compatibility impact

The Python 2 stack will stay in Fedora, it will just not be the default one. Depending on the modifications done to Python packaging guidelines, this probably means that Python 2 packages will stay the way they are and default tools will drag in python3- dependencies. Upstream recommends, that /usr/bin/python should point to Python 2 runtime for the time being, so if we go with that, there shouldn't be any serious compatibility impact:

  • Users will still be able to install Python 2 packages
  • Both Python 2 and 3 stacks will still live in parallel

Libraries that are built with Python only once (like gdb) may force users to rewrite their custom scripts (that use the bindings) to Python 3.

How To Test

TBD

User Experience

Users shouldn't notice any change in behaviour, except from installation of python3- packages by default.

Dependencies

See https://fedoraproject.org/wiki/User:Churchyard/python3 (our tracking page with notes) or https://bugzilla.redhat.com/show_bug.cgi?id=1014209 (tracking bug).

Contingency Plan

  • Contingency mechanism: (What to do? Who will do it?) Don't merge the koji side-tag into rawhide, revert changes in dist-git.
  • Contingency deadline: Development freeze
  • Blocks release? No

Documentation

http://docs.python.org/dev/howto/pyporting.html

http://docs.python.org/3/howto/cporting.html

https://wiki.gnome.org/PyGObject/IntrospectionPorting

Release Notes