Skip to main content

PyCon 2011: Interview with Lennart Regebro - “Porting to Python 3”

By Brian Curtin

The Python world has come a long way since December 2008 when 3.0 was first released. Books have been released, blogs have been written, and most importantly, projects have been ported. Recently, NumPy and SciPy checked in their porting work. We’ve heard rumblings of Django on 3.x, possibly as early as this summer. Python 3.1.3 was released in the fall and 3.2 final is around a week away, and with 2.7 being the end of the 2.x line, all core hands are on Python 3.

Lennart Regebro knows all about this. He’s the author of a new book, Porting to Python 3, and he’s giving a talk by the same name. The idea to write the book came from a lack of published material on the topic and an interest in writing for the now defunct Python Magazine. “The lack of documentation has been the biggest hurdle, [so] if you want to port to Python 3 you have been stepping into the dark. Since I had been using Python 3 and porting to it on my free time since early 2008 I had a bit of experience to share,” says Lennart. He then took his article series and had the basis for a book which he created with reStructuredText and Sphinx.

While he agrees that the separation of string contents into binary data and Unicode text was the right move, it’s a challenge you’ll have to undertake if your application doesn’t already handle all text as Unicode. “This is where you can expect the biggest problems,” he claims. Luckily he’s taking the time to cover it in his talk. He also covers the important topic of porting strategies, including branching, continuous 2to3 conversion, and single codebase projects.

Asked about his hardest porting project, zope.testing appears to be the winner. The package used doctests from before they were included in the standard library, along with a custom testrunner module, so the first step was to separate and deprecate. “I think I ended up deleting the port and restarting two or three times either because I made a hash of it or the trunk code had changed so much that it was easier to restart than to merge the changes.” Although the port isn’t complete, “porting a package takes between a couple of hours and a couple of days, and is a lot of fun, except if you have a lot of doctests.”

The Zope Component Architecture tops his most-wanted list and is the driving force behind his efforts. “It's really cool, but uses a lot of Python internals so porting it is a challenge,” he says, mentioning that a further complication is the need of writing fixers, for which there is little documentation.” Understanding how 2to3 works internally was another challenge, which led to a chapter in his book. Along with 2to3, Benjamin Peterson’s six package has been helping Lennart along with his porting. “I was planning to write such a module myself, but now I'm glad I didn't, because Benjamin did a much better job than I would have,” he says.

Lennart is a PyCon veteran, coming to the 2008 and 2009 conferences in Chicago, along with several EuroPython events, as well as Polish and French PyCons. The evenings are some of his favorite times, “because there are so many people around you that are much smarter than you are, and are friendly and open and willing to hang with you over coffee or a drink.” Sprints were one of the highlights of his 2009 experience, where he organized a Zope sprint without hopes of a great turnout. He ended up being wrong: “we got a quite a big gathering with many of the top Zope names and had some fantastic discussions on the way forward for Zope, as well as an extremely productive sprint!” He finished the interview by saying, “that was great fun, and those type of things seem to happen a lot on PyCon.”

If you’re interested in the PyCon sprints, check out the sprint page, and don’t forget to buy your tickets soon!

Comments

Popular posts from this blog

PyCon 2019 Registration is Open!

It is that time of year! Registration for PyCon 2019 has launched and once again we are selling the first 800 tickets at a discounted rate.
How to register Once you have created an account on us.pycon.org, you can register via the registration tab on the conference website.
Registration costs The early bird pricing is $550 for corporate, $350 for individuals, and $100 for students. Once we sell the first 800 tickets, regular prices will go into effect. Regular pricing will be $700 for corporate, $400 for individuals, and $125 for students.
PyCon will take place May 1-9, 2019 in Cleveland, Ohio. The core of the conference May 3-5, 2019 packs in three days worth of our community’s 95 best talks, amazing keynote speakers, and our famed lightning talks to close out each day, but it is much more than that.
It’s having over 3,000 people in one place to learn from and share with. It’s joining a conversation in the hallway with the creators of open source projects. It’s taking yourself from…

PyCon 2019 proposal submission deadline is fast approaching!

The busy holiday season is upon us and before you know it the new year will be here. January 3rd AoE is the deadline to submit proposals. We've added a draft feature to proposals so you can begin your proposal submission now and come back to make final edits before the January 3rd deadline.
Begin by creating an account on us.pycon.org/2019/dashboard.  Details on submitting a proposal can be found here. January 3, 2019: Deadline to submit a PyCon Talk proposal,Poster proposal,Education Summit proposal, andLas PyCon Charlas proposalFebruary 12, 2019: Deadline to submit applications for Financial aidMarch 3, 2019: Financial Assistance grants awardedMarch 30, 2019: Deadline to respond to offer of Financial AssistanceOur Early Bird tickets are going quickly. If you are hoping to purchase your Student, Individual, or Corporate ticket at our discounted rate, then your time is now — register as soon as you can!
We look forward to seeing you in Cleveland in May 2019!
   [Image…

Pycon 2019 Call for Proposals is Open!

The time is upon us again! PyCon 2019’s Call for Proposals has officially opened for talks, tutorials, posters, education summit presentations, as well as the hatchery program PyCon Charlas. PyCon is made by you, so we need you to share what you’re working on, how you’re working on it, what you’ve learned, what you’re learning, and so much more.

Please make note of important deadlines for submissions:
Tutorial proposals are due November 26, 2018.Talk, Charlas, Poster, and Education Summit proposals are due January 3, 2019.
Who should write a proposal? Everyone! If you’re reading this post, you should write a proposal. PyCon is about uniting and building the Python community, and we won’t advance as an open community if we’re not open with each other about what we’ve learned throughout our time in it. It isn’t about being the smartest one in the room, so we don’t just pick all of the expert talks. It’s about helping everyone move together. “A rising tide lifts all boats,” if you will.

We…