Added notes on Python 3
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by Armin Ronacher · committed by Armin Ronacher · parent 2c9c269 · Browse files · 4 files·+64 added−9 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+64 added−9 removed
- other:+64 added−9 removed
Provenance
- Commit
0ac9582- Tree
13829da- Author
Armin Ronacher <armin.ronacher@active-4.com>- Committer
Armin Ronacher <armin.ronacher@active-4.com>- Parent
2c9c269
4 files changed+64 added−9 removed
modified:docs/advanced_foreword.rst+9 added-8 removed
50 unmodified lines51 52 Currently the Python community is in the process of improving libraries to53 support the new iteration of the Python programming language. While the54 situation is greatly improving there are still some issues that make it55-hard for us to switch over to Python 3 just now. These problems are55+hard for users to switch over to Python 3 just now. These problems are56 partially caused by changes in the language that went unreviewed for too57 long, partially also because we have not quite worked out how the lower-58 level API should change to account for the Unicode differences in Python 3.59 60-Werkzeug and Flask will be ported to Python 3 as soon as a solution for61-the changes is found, and we will provide helpful tips how to upgrade62-existing applications to Python 3. Until then, we strongly recommend63-using Python 2.6 and 2.7 with activated Python 3 warnings during64-development. If you plan on upgrading to Python 3 in the near future we65-strongly recommend that you read `How to write forwards compatible66-Python code <http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/>`_.60+We strongly recommend using Python 2.6 and 2.7 with activated Python 361+warnings during development. If you plan on upgrading to Python 3 in the62+near future we strongly recommend that you read `How to write forwards63+compatible Python code64+<http://lucumr.pocoo.org/2011/1/22/forwards-compatible-python/>`_.65 66+If you do want to dive into Python 3 already have a look at the67+:ref:`python3_support` page.68+69 Continue to :ref:`installation` or the :ref:`quickstart`.modified:docs/contents.rst.inc+1 added
51 unmodified lines52 security53 unicode54 extensiondev55 styleguide56+ python357 upgrading58 changelog59 licensemodified:docs/installation.rst+2 added-1 removed
12 unmodified lines13 could do that, but the most kick-ass method is virtualenv, so let's have a look14 at that first.15 16 You will need Python 2.6 or higher to get started, so be sure to have an17-up-to-date Python 2.x installation. Python 3.x is not supported.17+up-to-date Python 2.x installation. For using Flask with Python 3 have a18+look at :ref:`python3-support`.19 20 .. _virtualenv:21 22 virtualenv151 unmodified linesadded:docs/python3.rst+52 added
1+.. _python3_support:2+3+Python 3 Support4+================5+6+Flask and all of its dependencies support Python 3 so you can in theory7+start working on it already. There are however a few things you should be8+aware of before you start using Python 3 for your next project.9+10+API Stability11+-------------12+13+Some of the decisions made in regards to unicode and byte untilization on14+Python 3 make it hard to write low level code. This mainly affects WSGI15+middlewares and interacting with the WSGI provided information. Werkzeug16+wraps all that information in high-level helpers but some of those were17+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 those20+details as it was written before WSGI was updated to Python 3. While the21+API for Werkzeug and Flask on Python 2.x should not change much we cannot22+guarantee that this won't happen on Python 3.23+24+Few Users25+---------26+27+Python 3 currently has less than 1% of the users of Python 2 going by PyPI28+download stats. As a result many of the problems you will encounter are29+probably hard to search for on the internet if they are Python 3 specific.30+31+Small Ecosystem32+---------------33+34+The majority of the Flask extensions, all of the documentation and the35+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 is37+supported by Python 3 you don't know what happens six months from now. If38+you are adventurous you can start porting libraries on your own, but that39+is nothing for the faint of heart.40+41+Recommendations42+---------------43+44+Unless you are already familiar with the differences in the versions we45+recommend sticking to current versions of Python until the ecosystem46+caught up.47+48+The majority of the upgrade pain is in the lower-level libararies like49+Flask and Werkzeug and not in the actual high-level application code. For50+instance all of the Flask examples that are in the Flask repository work51+out of the box on both 2.x and 3.x and did not require a single line of52+code changed.