The future of Python 2
Python 3 has been out for close to four and a half years now—since December 2008—but its widespread adoption is still a ways off. Python 2.7 is younger—released in July 2010—but it is likely more commonly used than 3.x. In fact, usage of Python 2.x dwarfs that of the incompatible "next generation" Python. But with frameworks like Django and Twisted having been ported to Python 3.3, there is something of a feeling of inevitability for an eventual Python-3-only (or mostly) world. The only question is: how soon is eventual?
There are at least two questions floating around in the Python community with regard to future versions. One concerns how many more 2.7 releases there will be past the early April release of 2.7.4, while the other is a bit more amorphous: when will adoption of Python 3 really start to ramp up? The two questions are related, of course, but the problem is that the less knowable one will to a large extent govern how long 2.7 releases will be needed.
2.7 release manager Benjamin Peterson kicked off the discussion with a post provocatively titled "The end of 2.7". In it he posited that five years of maintenance was what was promised back when 2.7 was released in 2010, which would mean roughly another four six-monthly releases before 2.7 (and thus Python 2.x) would reach end of life. There were some questions about where Python 3 adoption would be by then, but there was no real opposition to Peterson's plan.
But there are the bigger questions. As was pointed out in the thread, there are still users of various end-of-life branches of the Python tree, including 2.4 and even 1.5. Those users are either happy with the existing version and unconcerned about security and other bug fixes—or they get support from one of the enterprise distributions such as RHEL, SUSE, or Ubuntu LTS. Contentment with those versions is not the only reason people stick with them, though, as there are real barriers to upgrading—especially to Python 3.
As Python creator (and the language's BDFL, benevolent dictator for life)
Guido van Rossum put it, there are several
issues that make migrating a large code base to a new Python version difficult
and "they all conspire to make it hard to move forward, but not
impossible
". He goes on to outline those problems, which are
largely comprised of the number of people and amount of time required,
difficulties with external libraries and frameworks, and the general
upheaval caused by such a move. Ultimately, though, he is optimistic:
Some suggestions in the thread that it is relatively straightforward to move to Python 3 by using tools like the six compatibility library were shot down by others. For example, Skip Montanaro noted that some code bases long predate the existence of six, or even Python 3. But it has gotten easier over time to migrate because new features have been added (or old features revived) to ease the transition. As Barry Warsaw pointed out, the Python developers have been learning from earlier porting efforts:
Van Rossum suggested that perhaps slowing down or stopping bug fixing in 2.7 might be the right course. Users have already worked around or otherwise dealt with any bugs they have run into. Ensuring that 2.7 continues to work on new releases of Windows and OS X (Linux too, but distributions normally take care of that) would instead be the focus. But there are some areas that do need new features; the IDLE IDE from the standard library has been mentioned as one area where bug fixes are needed.
Another interesting case is PyPy, which is an implementation of the Python language written in (a subset of) Python 2.7. Even PyPy3k, which will take Python 3 as input, is still written in RPython (restricted Python) based on 2.7. That means that the PyPy project will still be maintaining the 2.7 standard library for longer than the two years Peterson plans, as Maciej Fijalkowski noted.
When Martin von Löwis posited that it must
be library support that leaves people "stuck
" with
Python 2, Fijalkowski was quick to point
out another reason, at least for PyPy:
That problem is not limited to PyPy of course, there are lots of Python applications where the version of the underlying source code is not of any particular interest to users. The users want an application that works and regularly has new features, both of which could be negatively impacted by a Python version migration.
The consensus in the thread seems to be that Python 3 usage is
increasing, and perhaps even reaching a tipping point because of recent
migrations by frameworks like Django and Twisted. But Raymond Hettinger
reminded everyone of the informal survey he
conducted in his recent PyCon keynote,
which found that out of roughly 2500 people, "almost everyone
indicated that they had tried out Python 3.x
and almost no one was using it in production or writing code for it
".
On the other hand, Ian Ozsvald has collected
some data suggesting that Python 3 uptake is increasing.
In the final analysis, it won't be clear when (or if, though that outcome seems rather unlikely) a tipping point is reached until well after it happens. It is a bold step—some would say foolhardy—to change a language in a backward incompatible way as Python has done. It is not hard to see that any change of that sort will take some transitioning time. But the Python core developers are signaling that they believe the tipping point is at least in sight; anyone who has been blithely counting on 2.7 support continuing "forever" clearly needs to start at least thinking about their plans for the end of Python 2.7.
Posted Apr 18, 2013 0:53 UTC (Thu)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Apr 18, 2013 5:39 UTC (Thu)
by Wummel (guest, #7591)
[Link] (2 responses)
Posted Apr 18, 2013 5:43 UTC (Thu)
by rahulsundaram (subscriber, #21946)
[Link]
Posted Apr 18, 2013 6:56 UTC (Thu)
by mastro (guest, #72665)
[Link]
Posted Apr 25, 2013 12:31 UTC (Thu)
by phred14 (guest, #60633)
[Link] (4 responses)
At home I run Gentoo, and they have 2.7 and 3.2 both installed, though they're currently using 2.7 by default and are in the long process of making sure 3.x is fully enabled.
In this environment, while I may be intellectually curious about 3.x, the bread on my table depends on 2.6, and 3.x qualifies as a "distraction". About the time 3.x becomes available on RedHat Enterprise or becomes default on Gentoo I'll start learning it. Even at that I'd probably be ready and have my code ported before it's possible to deploy it. At this point I'll guess that I'll be retired before 3.x is a default part of the RedHat Enterprise installation at my workplace.
Part of your answer - get RedHat to at least make Python-3.x optionally available, and some way to install alongside Python-2.6, as with Gentoo slots.
Posted Apr 26, 2013 16:40 UTC (Fri)
by kmacleod (guest, #88058)
[Link]
Posted Apr 27, 2013 14:56 UTC (Sat)
by intgr (subscriber, #39733)
[Link] (2 responses)
What on Earth happened to Gentoo? It used to be an early adopter distro, but Python 3.3 was released in September 2012. Even fricking Ubuntu has Python 3.3 now.
Posted Apr 29, 2013 11:05 UTC (Mon)
by shane (subscriber, #3335)
[Link]
Posted Apr 29, 2013 11:47 UTC (Mon)
by Duncan (guest, #6647)
[Link]
On 2012-11-30, a 3.3.0-r1 ebuild was committed, along with revision bumps for other python slots, in a "cleanup".
As of 2013-04-28, Gentoo even has python-3.3.1. =:^)
So the reference in the grandparent wasn't to gentoo not /having/ 3.3, but rather, to what was installed on his system. Since gentoo has "slotted" python, individual python depending packages can specify the slots they can use, and individual users/installations can choose either an inclusive "deep" updates policy that keep everything updated to the latest it can use or a lazy "shallow" updates policy that only update dependencies when necessary, in addition to the stale^H^Hble/~arch (testing) choice, it's quite likely that either 3.3 wasn't unmasked to whatever he's running, or that he was using "shallow" updating policy and simply hadn't pulled it in.
Actually, a quick keyword check here shows that while 3.3.0, 3.3.0-r1, and 3.3.1 are all in-tree, at least for x86 and amd64, there's no 3.3-slot keyworded even to ~arch, let alone stable. Thus, they're available in-tree but keyword masked and won't be pulled in unless someone unmasks them. Presumably there's still quite a few dependency bugs being worked out, not even allowing slot 3.3 into ~arch/testing.
But it's there for those that want to unmask it, as I routinely do for various things, tho not python. (As a matter of fact, I've had =dev-lang/python-3* package.mask-ed for several years now, since it was first unmasked and portage tried to install it, so only 2.7 installed here. Presumably around 2015 when upstream 2.7 support drops, or when something I want/need python support for drops 2.x support, I'll finally unmask 3.x and hope everything I need "just works" with some standard 3.x by then, that I can standardize on as my single installed version again, as I am on 2.7 now.)
As a note of explanation, while gentoo does tend to be leading edge in many things, for toolchain and heavy-depended packages like gcc and python, while they're generally available in-tree early on, gentoo often takes longer to keyword them, both because there's slotting/unmasking available for those who have a need for a specific version so taking a bit longer to unmask isn't as huge a deal as it is on a distro (like the mentioned Red Hat) where there's (apparently) only one or a couple versions available, and because especially for things like gcc, the entire tree must be patched to build with the new version, and patched packages made available at the corresponding keyword level (~arch keyworded before gcc goes ~arch, stable before gcc goes stable), before gcc itself gets keyworded.
Of course people like me tend to unmask a new gcc early, pulling patches from the various bugs and dropping them in /etc/portage/patches/* as appropriate, even before they're applied to the corresponding ~arch packages...
python 3.3 is probably having similar keywording issues ATM. As I said I have 3.x entirely masked here so haven't paid that much attention to it, but IIRC I did see a comment on the dev list or on some bug or other that 3.3.1 should resolve most of the problems they were having, so I expect it will be unmasked in-tree fairly soon, while 3.3.0 wasn't as it had too many issues to deal with.
The future of Python 2
Python 3.3 is indeed much easier to port to. For example it accepts the unicode string syntax The future of Python 2
u""
so you don't have to change all those strings.
For me, the blocking factors are libraries (Python GTK and twill for example) and the fact the Python 3.3 is not available in Debian testing/stable. So I will have to wait for the next Debian release after wheezy.
The future of Python 2
The future of Python 2
The future of Python 2
The future of Python 2
The future of Python 2
Gentoo as an early adopter
The future of Python 2