Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
cb1dde5d
Kaydet (Commit)
cb1dde5d
authored
Mar 13, 2015
tarafından
Brett Cannon
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge 3.4
üst
469d0fbd
2645bad0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
pyporting.rst
Doc/howto/pyporting.rst
+13
-13
No files found.
Doc/howto/pyporting.rst
Dosyayı görüntüle @
cb1dde5d
...
...
@@ -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