|
| 1 | +.. _python3_support: |
| 2 | + |
| 3 | +Python 3 Support |
| 4 | +================ |
| 5 | + |
| 6 | +Flask and all of its dependencies support Python 3 so you can in theory |
| 7 | +start working on it already. There are however a few things you should be |
| 8 | +aware of before you start using Python 3 for your next project. |
| 9 | + |
| 10 | +API Stability |
| 11 | +------------- |
| 12 | + |
| 13 | +Some of the decisions made in regards to unicode and byte untilization on |
| 14 | +Python 3 make it hard to write low level code. This mainly affects WSGI |
| 15 | +middlewares and interacting with the WSGI provided information. Werkzeug |
| 16 | +wraps all that information in high-level helpers but some of those were |
| 17 | +specifically added for the Python 3 support and are quite new. |
| 18 | + |
| 19 | +A lot of the documentation out there on using WSGI leaves out those |
| 20 | +details as it was written before WSGI was updated to Python 3. While the |
| 21 | +API for Werkzeug and Flask on Python 2.x should not change much we cannot |
| 22 | +guarantee that this won't happen on Python 3. |
| 23 | + |
| 24 | +Few Users |
| 25 | +--------- |
| 26 | + |
| 27 | +Python 3 currently has less than 1% of the users of Python 2 going by PyPI |
| 28 | +download stats. As a result many of the problems you will encounter are |
| 29 | +probably hard to search for on the internet if they are Python 3 specific. |
| 30 | + |
| 31 | +Small Ecosystem |
| 32 | +--------------- |
| 33 | + |
| 34 | +The majority of the Flask extensions, all of the documentation and the |
| 35 | +vast majority of the PyPI provided libraries do not support Python 3 yet. |
| 36 | +Even if you start your project with knowing that all you will need is |
| 37 | +supported by Python 3 you don't know what happens six months from now. If |
| 38 | +you are adventurous you can start porting libraries on your own, but that |
| 39 | +is nothing for the faint of heart. |
| 40 | + |
| 41 | +Recommendations |
| 42 | +--------------- |
| 43 | + |
| 44 | +Unless you are already familiar with the differences in the versions we |
| 45 | +recommend sticking to current versions of Python until the ecosystem |
| 46 | +caught up. |
| 47 | + |
| 48 | +The majority of the upgrade pain is in the lower-level libararies like |
| 49 | +Flask and Werkzeug and not in the actual high-level application code. For |
| 50 | +instance all of the Flask examples that are in the Flask repository work |
| 51 | +out of the box on both 2.x and 3.x and did not require a single line of |
| 52 | +code changed. |
0 commit comments