python3.rst
This file
Path
docs/python3.rst
52 lines · 2.0 KiB
Last changed by
Added notes on Python 3Armin Ronacherbefore adoption0ac9582
History of this fileTake it
1.. _python3_support:23Python 3 Support4================56Flask and all of its dependencies support Python 3 so you can in theory7start working on it already. There are however a few things you should be8aware of before you start using Python 3 for your next project.910API Stability11-------------1213Some of the decisions made in regards to unicode and byte untilization on14Python 3 make it hard to write low level code. This mainly affects WSGI15middlewares and interacting with the WSGI provided information. Werkzeug16wraps all that information in high-level helpers but some of those were17specifically added for the Python 3 support and are quite new.1819A lot of the documentation out there on using WSGI leaves out those20details as it was written before WSGI was updated to Python 3. While the21API for Werkzeug and Flask on Python 2.x should not change much we cannot22guarantee that this won't happen on Python 3.2324Few Users25---------2627Python 3 currently has less than 1% of the users of Python 2 going by PyPI28download stats. As a result many of the problems you will encounter are29probably hard to search for on the internet if they are Python 3 specific.3031Small Ecosystem32---------------3334The majority of the Flask extensions, all of the documentation and the35vast majority of the PyPI provided libraries do not support Python 3 yet.36Even if you start your project with knowing that all you will need is37supported by Python 3 you don't know what happens six months from now. If38you are adventurous you can start porting libraries on your own, but that39is nothing for the faint of heart.4041Recommendations42---------------4344Unless you are already familiar with the differences in the versions we45recommend sticking to current versions of Python until the ecosystem46caught up.4748The majority of the upgrade pain is in the lower-level libararies like49Flask and Werkzeug and not in the actual high-level application code. For50instance all of the Flask examples that are in the Flask repository work51out of the box on both 2.x and 3.x and did not require a single line of52code changed.