How CherryPy supports Python 2 and 3
- Type:
- Talk
- Audience level:
- Intermediate
- Category:
- Core Python (Language, Stdlib)
March 10th 4:55 p.m. – 5:30 p.m.
Description
CherryPy was the first web framework to be made available for use with Python 3, and we tried several approaches to support both Python 2 and 3 before settling on one. Learn about the ups and the downs of each approach, and ways you can make your own porting project easier.
Abstract
The CherryPy project was the first web framework to support Python 3. At the same time, we needed to continue to support and improve the Python 2 implementation. It's taken plenty of time and lots of experimentation to find out the best way. We will explore four different ways to support both Python 2 and 3, commenting on the pros and cons of each.
- Intro
- Python 3 change highlights
- Special concerns for I/O, including WSGI
- Approach 1: 2to3
- Approach 2: separate branches
- Approach 3: setup.py switch
- Approach 4: compatibility layer
- Q&A