diff options
author | Brett Cannon <brett@python.org> | 2015-03-13 16:49:44 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2015-03-13 16:49:44 (GMT) |
commit | 2645bad04ff9ebbbda6fcf26282ac3af36f5e772 (patch) | |
tree | 4d8851a191ba1e2a1b3e8055a5dfff5d392206d2 /Doc | |
parent | 577fc4e87f59b94f2e906c77654a44a2ee586c1e (diff) | |
download | cpython-2645bad04ff9ebbbda6fcf26282ac3af36f5e772.zip cpython-2645bad04ff9ebbbda6fcf26282ac3af36f5e772.tar.gz cpython-2645bad04ff9ebbbda6fcf26282ac3af36f5e772.tar.bz2 |
Make the case to only support Python 2.7 when supporting 2/3 simultaneously
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/howto/pyporting.rst | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Doc/howto/pyporting.rst b/Doc/howto/pyporting.rst index d2cd9de..5e875cd 100644 --- a/Doc/howto/pyporting.rst +++ b/Doc/howto/pyporting.rst @@ -28,15 +28,14 @@ The Short Explanation To make your project be single-source Python 2/3 compatible, the basic steps are: -#. Update your code to drop support for Python 2.5 or older (supporting only - Python 2.7 is ideal) +#. Only worry about supporting Python 2.7 #. Make sure you have good test coverage (coverage.py_ can help; ``pip install coverage``) #. Learn the differences between Python 2 & 3 #. Use Modernize_ or Futurize_ to update your code (``pip install modernize`` or ``pip install future``, respectively) #. Use Pylint_ to help make sure you don't regress on your Python 3 support - (if only supporting Python 2.7/3.4 or newer; ``pip install pylint``) + (``pip install pylint``) #. Use caniusepython3_ to find out which of your dependencies are blocking your use of Python 3 (``pip install caniusepython3``) #. Once your dependencies are no longer blocking you, use continuous integration @@ -67,26 +66,27 @@ Keep those key points in mind while you read on about the details of porting your code to support Python 2 & 3 simultaneously. -Drop support for Python 2.5 and older (at least) ------------------------------------------------- +Drop support for Python 2.6 and older +------------------------------------- While you can make Python 2.5 work with Python 3, it is **much** easier if you -only have to work with Python 2.6 or newer (and easier still if you only have -to work with Python 2.7). If dropping Python 2.5 is not an option then the six_ -project can help you support Python 2.5 & 3 simultaneously +only have to work with Python 2.7. If dropping Python 2.5 is not an +option then the six_ project can help you support Python 2.5 & 3 simultaneously (``pip install six``). Do realize, though, that nearly all the projects listed in this HOWTO will not be available to you. -If you are able to only support Python 2.6 or newer, then the required changes +If you are able to skip Python 2.5 and older, then the required changes to your code should continue to look and feel like idiomatic Python code. At worst you will have to use a function instead of a method in some instances or have to import a function instead of using a built-in one, but otherwise the overall transformation should not feel foreign to you. -But please aim for Python 2.7. Bugfixes for that version of Python will continue -until 2020 while Python 2.6 is no longer supported. There are also some tools -mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), and -this will become more commonplace as time goes on. +But you should aim for only supporting Python 2.7. Python 2.6 is no longer +supported and thus is not receiving bugfixes. This means **you** will have to +work around any issues you come across with Python 2.6. There are also some +tools mentioned in this HOWTO which do not support Python 2.6 (e.g., Pylint_), +and this will become more commonplace as time goes on. It will simply be easier +for you if you only support the versions of Python that you have to support. Make sure you specify the proper version support in your ``setup.py`` file -------------------------------------------------------------------------- |