On Mon, Jun 26, 2017 at 9:26 AM, jan matejek <jmatejek@suse.com> wrote:
Fellow openSUSists,
this has been a long time coming, and I'd now like to start the actual process of switching the default Python implementation to Python 3 in Tumbleweed.
First of all, big thanks to everyone who is converting (or has converted) their packages to singlespec. That alone makes the Python 3 switch much easier than it would be otherwise.
Then, details.
When: * in the coming weeks. I'd like to do some tests and gather feedback before actually moving forward. A heads-up e-mail will come before anything is actually headed to TW.
Why: * Python 2 is very near its end of life [1], the vast majority of our stuff already works in python3. We want to have python3 as default in SLE 15, so now's a very good time to start.
What will happen: * `python` package will be renamed to `python2` and will obsolete/provide `python <= 2.7.13` * `python3` already provides `python = 3.6` and will also obsolete `python < %version` This should mean that if you don't require python2 on your system, it will be uninstalled, otherwise it will be replaced by python2. * /usr/bin/python will be switched to point to /usr/bin/python3. Other unversioned python binaries will also be switched. * python packages in patterns will be replaced by the corresponding python3 ones
What else will happen: * Stuff will break! The breakage will be contained to a testing project at first. * python packages that are not yet converted to singlespec will switch over to python3. Some of them will magically continue working, others will break. * For those we will also start getting file conflicts with python3 versions. A good opportunity to revisit and either completely drop the python2 version, convert to singlespec, or to explicitly-python2 package. * python packages that _are_ converted to singlespec will work just fine * as will explicitly-python3 packages from d:l:py3 * packages that _require_ python stuff will also magically get python3. They might very well also break * through this, we will learn where we still depend on Python 2, and hopefully fix it * note that if a script is using "/usr/bin/python" as shebang (or worse, "/usr/bin/env python"), it's already wrong. The shebang must be versioned, unless the script actually works with an arbitrary python version
regards m.
Considering the upstream recommendation that we not make /usr/bin/python point to python3 that others have brought up, let me make an alternative proposal: Step 1 (these can all be done roughly simultaneously): 1.1. Rename python to python2. 1.2. We set up /usr/bin/python2 as an update-alternative to /usr/bin/python in the python2 package. 1.3. The python3 package provides no update-alternative for /usr/bin/python. Instead we provide a "python3-as2" package (or some similar name) that provides the update-alternative for /usr/bin/python with a higher priority than python2 does. So people can explicitly choose to install that package to change the symlink. 1.4.We have a package that is installed by default as part of the base system that includes a very low-priority update-alternative for /usr/bin/python and returns an error instructing people to install the python2 or python3-as2 package when they try to run a script with /usr/bin/python with neither of these packages installed. 1.5. We set an rpmlint warning for bare "python" shebangs, recommending these be changed to "python2" or "python3". This has to be explicitly disabled on a case-by-case basis using an rpmlintrc. 1.6. We set an rpmlint warning for packages that don't have the "python2-" prefix but depend on python2 or python2-foo packages, suggesting that the package change to python3 by default if possible. Again, this can be explicitly disabled using an rpmlintrc in cases where only python2 is supported (e.g. calibre) or where there are python2 and python3 versions but not prefix (e.g. spyder). 1.7. All python-foo packages will be renamed to python2-foo Step 2 (these can all be done roughly simultaneously): 2.1. Patterns will switch from using python2-foo packages to python3-foo. 2.2. Update-alternatives will prefer python3. If possible, and rpmlint check will be implemented to guarantee this. Failure to do this will be grounds for rejection from openSUSE:Factory. 2.3. The rpmlint warning for bare "python" shebangs becomes an error and grounds for exclusion from openSUSE:Factory. Step 3 (these can all be done roughly simultaneously): 3.1. Python2 will not be installed by default. 3.2. Python3 will be installed by default. Step Infinity (after upstream says we should change what /usr/bin/python points to): Inf.1. We merge "python3-as2" package into "python3", having python3 provide the same update-alternative with the same priority and provide/obsolete python3-as2 I think this approach will minimize unexpected breakage while still putting the emphasis on python3 and allowing us to change the default implemention with less breakage down the road. -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-factory+owner@opensuse.org