Friday 4 March 2016

Knocking Python 2 off the desktop iso

A long standing goal for Ubuntu has been the demotion of Python 2 off of the
default installation images[1]. This is something many folks have been
working on for quite a few cycles, and it's finally within our reach for
desktop (server and touch already have no Python 2 on it). Of course this is
within the context of a much longer term, cross distro effort to port the
entire world to Python 3 <wink>.

We have one last thing holding Python 2 on the desktop image, and it's a
problematic one: system-config-printer. Actually s-c-p is already itself
ported to Python 3, but it transitively depends on Python 2 through the chain
of python3-smbc -> libsmbclient -> samba-libs -> libpython2.7. So the real
problem is fully porting Samba to Python 3. Ubuntu is not the only distro
converging on this bottleneck.

Clearly, we won't have an untangled the Samba stack in time for 16.04. I'm
proposing instead to demote python3-smbc to a Suggests[2] for
system-config-printer, which should drop it from the desktop image, thus
allowing us to purge libpython2.7, python2.7, and python.

The downside of course is that you won't be able to automatically detect
Windows printers after a default install. For users who don't have network
attached (e.g. IPP) printers, that's a hardship. The question is whether
there are enough users who fall into that category to outweigh keeping the
full Python 2 stack on the image.

There's a middle way perhaps. It's not fantastic, but there is precedence.
In a similar situation, deja-dup depends on duplicity which has not yet been
ported, so in order to do backups, deja-dup exposes a button to install some
additional packages. That of course pulls Python 2 back in, but it does at
least keep the desktop iso smaller and doesn't affect anybody who doesn't want
to do backups[3].

In a similar way, we could do a runtime check in system-config-printer to see
if the python3-smbc library is available, and if not, expose a button to
install the necessary package if the user wants to search for a Windows
printer. There are already places in the code that catch ImportErrors if the
Samba-requiring bits aren't available, so s-c-p should continue to work
without it. That would allow us to knock Python 2 off of desktop, and users
without Windows printers could ignore the reduction in functionality, while
users with Windows printers would at least have a discoverable path to adding
that functionality back.

Given how close we are to completing this long-term effort, I'd vote for just
the Suggests demotion or adding the button. But I'm admittedly biased. :)

Cheers,
-Barry

[1] https://blueprints.launchpad.net/ubuntu/+spec/foundations-x-python3-only
[2] LP: #1552868
[3] At least, via deja-dup! We all do regular backups, right?! :)