Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
2645bad0
Commit
2645bad0
authored
Mar 13, 2015
by
Brett Cannon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the case to only support Python 2.7 when supporting 2/3 simultaneously
parent
577fc4e8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
Doc/howto/pyporting.rst
Doc/howto/pyporting.rst
+13
-13
No files found.
Doc/howto/pyporting.rst
View file @
2645bad0
...
...
@@ -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 new
er, then the required changes
If you are able to
skip Python 2.5 and old
er, 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
--------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment