From Fedora Project Wiki
m (→‎Upstream regression test suite: note that the testsuite is in python3-test, not python3)
Line 23: Line 23:
| gtk || pygtk2 ||  Not yet ready: https://bugzilla.gnome.org/show_bug.cgi?id=566641|| Need to finish upstream work
| gtk || pygtk2 ||  Not yet ready: https://bugzilla.gnome.org/show_bug.cgi?id=566641|| Need to finish upstream work
|-
|-
| rpm || rpm-python || Not yet ready: http://dmalcolm.livejournal.com/3340.html || Need to finish upstream work
| rpm || rpm-python (subpackage of "rpm")|| Not yet ready: http://dmalcolm.livejournal.com/3340.html || Need to finish upstream work
|-
|-
|}
|}

Revision as of 15:38, 21 October 2009

Python 3

Summary

A packaged version of python 3.* will be provided within Fedora 13 as an optional component, parallel-installable with the Python 2 stack.

The critical system components that use Python 2 (yum, anaconda) shall continue to use Python 2.

Owner

Current status

  • Targeted release: Fedora 13
  • Last updated: 2009-10-21
  • Percentage of completion: 10%

Package review for python3: NEW: https://bugzilla.redhat.com/show_bug.cgi?id=526126

Module status (alphabetical by python module name)

Python Module Fedora Python 2 package Upstream status Fedora Python 3 package
gtk pygtk2 Not yet ready: https://bugzilla.gnome.org/show_bug.cgi?id=566641 Need to finish upstream work
rpm rpm-python (subpackage of "rpm") Not yet ready: http://dmalcolm.livejournal.com/3340.html Need to finish upstream work

Detailed Description

Python 3 is intended by upstream to be the future of Python, but we have many critical components that use Python 2. Python 2 and Python 3 are sufficiently different that we need both (try writing "print" in each). Python 2 will be around for a long time.

An interesting summary of Python 3 adoption can be seen here: http://renesd.blogspot.com/2009/09/py3kpython3-more-than-one-year-on-096.html

How to do this? I propose that Fedora shall have separate, parallel-installable Python 2 and Python 3 stacks. I believe we can get things to the point where on a Fedora box you'd be able to install both stacks, and have some processes running python 2 code, and some running python 3, simultaneously.

Where I would draw the line is on having both python 2 and python 3 running within the same _process_: the two libraries share most of their symbol names, but with differing implementations, and the result of trying to dynamically link the two into the same address space would be highly unstable.

As an example, you'd be able to install both mod_python and mod_python3 rpms, but you wouldn't be able to (sanely) configure httpd to have both running simultaneously (I guess we should add a run-time warning for this case)

Benefit to Fedora

Fedora has long been a great platform for doing Python 2 development, but we don't yet have Python 3. Having Python 3 available via rpms will extend our Python coverage.

Note also:

  • Python 3.0 was released almost 10 months ago, on 2008-12-03, and the latest release of the 3.* branch is 3.1.1, released on 2009-08-17.
  • Other distros have python 3, though not necessarily with anything "on top" resembling the full python 2 stack.
  • We have a working, valuable python 2 stack, which is used by critical system components (yum and anaconda): we must not destabilize the python 2 stack.
  • Python 3 is sufficiently different from python 2 that we need them to be independent software stacks.

Scope

A plan for packaging Python 3 and Python 3 modules was posted to fedora-devel-list here: https://www.redhat.com/archives/fedora-devel-list/2009-October/msg00054.html

A rough plan for Fedora 13 might be:

  • get python3 packaged in a manner compatible with the above
  • (persuade /usr/lib/rpm/brp-python-bytecompile to use the correct python when building rpms containing .py files)
  • get rpm bindings working with python3
  • get some useful components working e.g. a web stack: Django, TurboGears etc (though e.g. Django's py3k support is a long way off IIRC); ideas?
  • solidify packaging guidelines for python 2 vs python 3 once we've got some experience with the above and hopefully proven the techniques
  • look at porting major components over to python3 (but probably don't actually do this for F13; leave python 2 as the critical component, I suspect): yum (rpm), anaconda
  • add the new packages to the comps file. It's not yet clear what changes to the comps file are required.

At a minimum, we'd want python 3 to be available as an rpm via yum.

How To Test

Testing Python 3 functionality

You should be able to test the new python 3 stack using:

$ yum install python3

and then starting the python 3 interpreter using

$ python3

You should then see the Python 3 interpreter:

Python 3.1.1 (r311:74480, Sep 29 2009, 17:01:17) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Follow the "Dive Into Python 3" tutorial

If you've installed the python3 rpm, it should be possible for you to follow the tutorial on Python 3 given here: http://diveintopython3.org/

This is an excellent tutorial, and working through it with our RPMs makes a good test that all is working as expected (obviously it would be a major task to work through the whole book, but at least you'd learn a lot in the process).

Ensuring non-brokenness of Python 2 stack

The Python 3 stack should not interfere with the Python 2 stack; the latter is used by many components. The most critical ones here are yum and anaconda.

Please verify that "yum" still works after installing python3.

If there are other python 2 rpms that you are familiar with, please check that they still work after installing the python3 rpm.

Uninstallability of Python 3

  • Try uninstalling python 3 using "yum remove python3".
  • It ought to be possible for you to remove python3 without affecting other components
  • Verify that other components still work as expected

Upstream regression test suite

Run Python's regression test suite (within the python3-test subpackage)

/usr/lib/python3.1/test/regrtest.py

and verify that no errors occur.

FIXME: need to come up with a list of expected failures here

Static testing

Verify that for all subpackages, on all architectures, that the python and python3 packages are independent:

  • verify that there aren't any paths (files/dirs/links) owned by both packages
  • verify that there aren't any "Provides" provided by both packages

FIXME: we should script this

User Experience

It should be possible to start a Python 3 interpreter by invoking:

$ python3
Python 3.1.1 (r311:74480, Sep 29 2009, 17:01:17) 
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 

The python 3 install should be independent of the python 2 install.

It should be possible to have some processes on the system running python 2 code, and some processes on the system running python 3 code. However you won't be able to run both python 2 and python 3 within the same process.

Dependencies

Getting the core "python3" package into Fedora requires us to come up with packaging rules for Python 3, but beyond that doesn't have any inter-project dependencies.

Building out the python 3 stack beyond the core interpreter component will involve working closely with many different upstream projects. The more we can do this, the better, but it's not necessary for achieving the main goal of having the core python 3 interpreter available via rpm.

Contingency Plan

We will be adding all-new RPMs to Fedora. If there's a problem, we can simply choose to not include them without impacting the rest of the Fedora 13 release.

Documentation

An excellent tutorial on Python 3 can be seen at http://diveintopython3.org/

Release Notes

Comments and Discussion