Python 3 migration status update across some key subcommunities (was Re: 2.7 is here until 2020, please don't call it a waste.)

On 31 May 2015 at 19:07, Ludovic Gasc <gmludo@gmail.com> wrote:
The education community started switching a while back - if you watch Carrie-Anne Philbin's PyCon UK 2014 keynote, one of her requests for the broader Python community was for everyone else to just catch up already in order to reduce student's confusion (she phrased it more politely than that, though). Educators need to tweak examples and exercises to account for a version switch, but that's substantially easier than migrating hundreds of thousands or even millions of lines of production code. And yes, if you learn Python 3 first, subsequently encountering Python 2's quirks and cruft is likely to encourage folks that know both versions of the language to start advocating for a version upgrade :) After accounting for the "Wow, the existing Python 2 install base is even larger than we realised" factour, the migration is actually in a pretty good place overall these days. The "enterprise" crowd really are likely to be the only ones that might need the full remaining 5 years of migration time (and they may potentially have even more time, if they're relying on a commercial redistributor). Web frameworks have allowed Python 3 development for a while now, and with Django switching their tutorial to Python 3 by default, Django downloads via pip show one of the highest proportions of Python 3 adoption on PyPI. www.python.org itself is now a production Python 3 Django web service, and the next generation of pypi.python.org will be a Pyramid application that's also running on Python 3. The dedicated async/await syntax in 3.5 represents a decent carrot to encourage migration for anyone currently using yield (or yield from) based coroutines, since the distinct syntax not only allows for easier local reasoning about whether something is an iterator or a coroutine, it also provides a much improved user experience for asynchronous iterators and context managers (including finally handling the "asynchronous database transaction as a context manager" case, which previous versions of Python couldn't really do at all). The matrix multiplication operator is similarly a major improvement for the science and data analysis part of the Python community. In terms of reducing *barriers* to adoption, after inviting them to speak at the 2014 language summit, we spent a fair bit of time with the Twisted and Mercurial folks over the past year or so working through "What's still missing from Python 3 for your use cases?", as Python 3.4 was still missing some features for binary data manipulation where we'd been a bit too ruthless in pruning back the binary side of things when deciding what counted as text-only features, and what was applicable to binary data as well. So 3.5 brings back binary interpolation, adds a hex() method to bytes, and adds binary data support directly to a couple of standard library modules (tempfile, difflib). If I understand the situation correctly, the work Guido et al have been doing on PEP 484 and type hinting standardisation is also aimed at reducing barriers to Python 3 adoption, by making it possible to develop better migration tools that are more semantically aware than the existing syntax focused tools. The type hinting actually acts as a carrot as well, since it's a feature that mainly shows its value when attempting to scale a *team* to larger sizes (as it lets you delegate more of the code review process to an automated tool, letting the human reviewers spend more time focusing on higher level semantic concerns). Finally, both Debian/Ubuntu and Fedora are well advanced in their efforts to replace Python 2 with Python 3 in their respective default images (but keeping Py2 available in their package repos). That work is close to finished now (myself, Slavek Kabrda, Barry Warsaw, and Matthias Klose had some good opportunities to discuss that at PyCon), although there are still some significant rough edges to figure out (such as coming up with a coherent cross-platform story for what we're going to do with the Python symlink), as well as a few more key projects to either migrate entirely, or at least finish porting to the source compatible subset of Python 2 & 3 (e.g. Samba). Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia

* Nick Coghlan <ncoghlan@gmail.com> [2015-06-01 00:15:01 +1000]:
I think a big issue here is the lack of good newcomer tutorials for Python 3. In the #python IRC channel, "learn Python the hard way"[1] is often recommended, and the common consensus seems to be that all other tutorials (other than the official one[2] which is clearly not aimed at newcomers to programming) seem to lack in some way. LPTHW is Python 2 only, so at least from what I see in #python, many newcomers are recommended to learn Python 2 rather than 3 because of that. I agree migrating large existing codebases (and developers) from 2 to 3 can be quite an issue, and a lot of energy went into making this easier (which is good!). But I also think nobody fresh to Python should start learning Python 2 now, except when there's a compelling reason (such as unported libraries without alternatives). Florian [1] http://learnpythonthehardway.org/book/ [2] https://docs.python.org/3/tutorial/index.html -- http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/

Florian Bruhin writes:
I think a big issue here is the lack of good newcomer tutorials for Python 3.
My business students (who are hardly advanced programmers) don't take tutorials seriously. They're way too focused on getting results. And there it's the "Doing <SOME PRACTICAL THING> with Python" books that are the killer. They just cargo cult those books, which are almost all still Python-2-focused in my experience. I don't think there's much we can do about those books except hope they're popular enough to justify new editions in short order, but I did want to point out that tutorials are not the only way beginners are introduced to Python, and a lot of those entry ports remain Python-2-oriented. What I would really like to see is a Python 3 (and if you really need Python 2, here's how it differs) version of Python: Essential Reference. BTW, for my students the main thing that trips them is not Unicode, but rather things like the print function (vs. statement in Python 2).
I agree, but the cargo cult thing is big for people coming to Python because somebody told them it's a good way to do something practical. (Fortunately my students have to deal with the insane proliferation of encodings in Japan, so "less mojibake" is a compelling reason for Python 3. I get no backtalk.<wink/>)

On 5/31/15 8:39 AM, Stephen J. Turnbull wrote:
If you have other favorite Python 2 books that you wish were revised/rewritten to have a Python 3 focus, please email me that as well. post-docs), "practical and simple" trumps "shiny and complex". Search gives them a mountain of resources. Yet, these users are looking for guidance on a reasonable approach to do the practical things that interest them. These creators, innovators, and experimenters care less about programming language or version than they do about building their ideas. Fortunately, the Python language, especially when combined with the Python community and its outreach, enables building these ideas...when we are not tripping all over our own perspectives of which version "should" suit the use case. Practically, use whichever version is best suited to the use case. Warmly, Carol P.S. Whether you develop for version 2, version 3, or both, thank you for doing so :-) -- *Carol Willing* Developer | Willing Consulting https://willingconsulting.com

On 5/31/2015 10:15 AM, Nick Coghlan wrote:
There is another somewhat invisible but real aspect of migration that tends to get ignored: the Python embedded in applications. LibreOffice 4.0, for instance, upgraded from 2.6 to 3.3 (around Jan 14 I think). It is currently in lo4dir/program/python-core-3.3.1. I presume unicode everywhere pluse the new-in-3.3 efficient, cross-platform unicode implementation had something to do with this. lo4dir/program/wizards is a package with subpackages and over 100 .py files. There are now perhaps 20 million LO4 users (and indirect 3.3 users) around the world (my guess from Wikipedia article). A few will use the PyUNO bridge for scripting. Installations are from CDs, direct downloads, torrents, and linux distributions, but not from pypi. In a few years, the number might grow to 100 million as more LO3 users upgrade and new users start with LO4. [...]
Perhaps we should investigate whether other apps with embedded but user accessible python has migrated and if not, ask why not (dependencies?) and whether planned. -- Terry Jan Reedy

2015-05-31 16:15 GMT+02:00 Nick Coghlan <ncoghlan@gmail.com>:
About the French article about Python 3 from a teacher on the production field, it's available again: https://translate.google.com/translate?hl=fr&sl=fr&tl=en&u=http%3A%2F%2Fsametmax.com%2Fpython-3-est-fait-pour-les-nouveaux-venus%2F
Exactly ;-)
More than a full-monty toolbox to migrate to Python 3 now available, I've a good hope when I see numbers like this: http://blog.frite-camembert.net/python-survey-2014.html Even if we have a statistical bia because it's only Pythonists who keep an eye on the Python actuality who have answer to this survey, by definition, people who are more aware about Python 3 migration than the "average" Python user, however, I don't remember exactly the theorem, but I know to diffuse a piece of information inside a community and to be accepted, the most work will be with the first 10%. After 10%, you have enough people to start to invert the network/group effects to keep the previous status. BTW, during PyCON, Guido did a keynote where he noticed that a lot of libraries don't support Python 3 yet, however a lot of famous Python packages are already ported. If about the absolute values, I was agree with him (more or less 5000 Python 3 packages on 55000 of PyPI if I remember), we should maybe do some "datamining" with PyPI data to have a more precise vision of the situation, for example: 1. Requests with 4195790 of downloads supports Python 3. hikvision, 9 downloads, doesn't support Python 3. It isn't fair to count with the same weight both products. In term of probability, you have more chances in your project to use Requests that use hikvision. If we ponderate each package by the number of download and calculate the percentage, we should have more of less the probability that a lambda project has all dependencies available for Python 3. 2. The acceleration of Python 3 adoption on PyPI: More complicated to calculate that because we need to know when the Python 3 trove classifier has appear on each library metadata. However, I'm pretty sure that we should see an acceleration. And we should be capable to do a prediction for a date range when a majority of Python packages will be available for Python 3. 3. Maybe some other hidden data, maybe Python scientific community should have better ideas. Web frameworks have allowed Python 3 development for a while now, and
Pretty cool :-)
Clearly, it should be cool that Python 3 becomes trending from async pattern community.
+10. I've made a daemon to provision a lot of stuff, I've a lot of code inside to switch between bytes and string exactly for that. If I understand the situation correctly, the work Guido et al have
Yes, indeed, it's another carrot. Finally, both Debian/Ubuntu and Fedora are well advanced in their
Yes, at least from my professional experience, Python-Debian team has done an awesome job for that: It works like a charm.

* Nick Coghlan <ncoghlan@gmail.com> [2015-06-01 00:15:01 +1000]:
I think a big issue here is the lack of good newcomer tutorials for Python 3. In the #python IRC channel, "learn Python the hard way"[1] is often recommended, and the common consensus seems to be that all other tutorials (other than the official one[2] which is clearly not aimed at newcomers to programming) seem to lack in some way. LPTHW is Python 2 only, so at least from what I see in #python, many newcomers are recommended to learn Python 2 rather than 3 because of that. I agree migrating large existing codebases (and developers) from 2 to 3 can be quite an issue, and a lot of energy went into making this easier (which is good!). But I also think nobody fresh to Python should start learning Python 2 now, except when there's a compelling reason (such as unported libraries without alternatives). Florian [1] http://learnpythonthehardway.org/book/ [2] https://docs.python.org/3/tutorial/index.html -- http://www.the-compiler.org | me@the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/

Florian Bruhin writes:
I think a big issue here is the lack of good newcomer tutorials for Python 3.
My business students (who are hardly advanced programmers) don't take tutorials seriously. They're way too focused on getting results. And there it's the "Doing <SOME PRACTICAL THING> with Python" books that are the killer. They just cargo cult those books, which are almost all still Python-2-focused in my experience. I don't think there's much we can do about those books except hope they're popular enough to justify new editions in short order, but I did want to point out that tutorials are not the only way beginners are introduced to Python, and a lot of those entry ports remain Python-2-oriented. What I would really like to see is a Python 3 (and if you really need Python 2, here's how it differs) version of Python: Essential Reference. BTW, for my students the main thing that trips them is not Unicode, but rather things like the print function (vs. statement in Python 2).
I agree, but the cargo cult thing is big for people coming to Python because somebody told them it's a good way to do something practical. (Fortunately my students have to deal with the insane proliferation of encodings in Japan, so "less mojibake" is a compelling reason for Python 3. I get no backtalk.<wink/>)

On 5/31/15 8:39 AM, Stephen J. Turnbull wrote:
If you have other favorite Python 2 books that you wish were revised/rewritten to have a Python 3 focus, please email me that as well. post-docs), "practical and simple" trumps "shiny and complex". Search gives them a mountain of resources. Yet, these users are looking for guidance on a reasonable approach to do the practical things that interest them. These creators, innovators, and experimenters care less about programming language or version than they do about building their ideas. Fortunately, the Python language, especially when combined with the Python community and its outreach, enables building these ideas...when we are not tripping all over our own perspectives of which version "should" suit the use case. Practically, use whichever version is best suited to the use case. Warmly, Carol P.S. Whether you develop for version 2, version 3, or both, thank you for doing so :-) -- *Carol Willing* Developer | Willing Consulting https://willingconsulting.com

On 5/31/2015 10:15 AM, Nick Coghlan wrote:
There is another somewhat invisible but real aspect of migration that tends to get ignored: the Python embedded in applications. LibreOffice 4.0, for instance, upgraded from 2.6 to 3.3 (around Jan 14 I think). It is currently in lo4dir/program/python-core-3.3.1. I presume unicode everywhere pluse the new-in-3.3 efficient, cross-platform unicode implementation had something to do with this. lo4dir/program/wizards is a package with subpackages and over 100 .py files. There are now perhaps 20 million LO4 users (and indirect 3.3 users) around the world (my guess from Wikipedia article). A few will use the PyUNO bridge for scripting. Installations are from CDs, direct downloads, torrents, and linux distributions, but not from pypi. In a few years, the number might grow to 100 million as more LO3 users upgrade and new users start with LO4. [...]
Perhaps we should investigate whether other apps with embedded but user accessible python has migrated and if not, ask why not (dependencies?) and whether planned. -- Terry Jan Reedy

2015-05-31 16:15 GMT+02:00 Nick Coghlan <ncoghlan@gmail.com>:
About the French article about Python 3 from a teacher on the production field, it's available again: https://translate.google.com/translate?hl=fr&sl=fr&tl=en&u=http%3A%2F%2Fsametmax.com%2Fpython-3-est-fait-pour-les-nouveaux-venus%2F
Exactly ;-)
More than a full-monty toolbox to migrate to Python 3 now available, I've a good hope when I see numbers like this: http://blog.frite-camembert.net/python-survey-2014.html Even if we have a statistical bia because it's only Pythonists who keep an eye on the Python actuality who have answer to this survey, by definition, people who are more aware about Python 3 migration than the "average" Python user, however, I don't remember exactly the theorem, but I know to diffuse a piece of information inside a community and to be accepted, the most work will be with the first 10%. After 10%, you have enough people to start to invert the network/group effects to keep the previous status. BTW, during PyCON, Guido did a keynote where he noticed that a lot of libraries don't support Python 3 yet, however a lot of famous Python packages are already ported. If about the absolute values, I was agree with him (more or less 5000 Python 3 packages on 55000 of PyPI if I remember), we should maybe do some "datamining" with PyPI data to have a more precise vision of the situation, for example: 1. Requests with 4195790 of downloads supports Python 3. hikvision, 9 downloads, doesn't support Python 3. It isn't fair to count with the same weight both products. In term of probability, you have more chances in your project to use Requests that use hikvision. If we ponderate each package by the number of download and calculate the percentage, we should have more of less the probability that a lambda project has all dependencies available for Python 3. 2. The acceleration of Python 3 adoption on PyPI: More complicated to calculate that because we need to know when the Python 3 trove classifier has appear on each library metadata. However, I'm pretty sure that we should see an acceleration. And we should be capable to do a prediction for a date range when a majority of Python packages will be available for Python 3. 3. Maybe some other hidden data, maybe Python scientific community should have better ideas. Web frameworks have allowed Python 3 development for a while now, and
Pretty cool :-)
Clearly, it should be cool that Python 3 becomes trending from async pattern community.
+10. I've made a daemon to provision a lot of stuff, I've a lot of code inside to switch between bytes and string exactly for that. If I understand the situation correctly, the work Guido et al have
Yes, indeed, it's another carrot. Finally, both Debian/Ubuntu and Fedora are well advanced in their
Yes, at least from my professional experience, Python-Debian team has done an awesome job for that: It works like a charm.
participants (6)
-
Carol Willing
-
Florian Bruhin
-
Ludovic Gasc
-
Nick Coghlan
-
Stephen J. Turnbull
-
Terry Reedy