You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/porting.rst
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,21 @@ Instructions and notes on porting code from Python 2 to both Python 3 and 2 usin
10
10
Step 0: setup
11
11
-------------
12
12
13
-
Step 0 goal: set up and see the tests passing on Python 2.
13
+
Step 0 goal: set up and see the tests passing on Python 2 and failing on Python 3.
14
14
15
15
a. Clone the package from github/bitbucket. Rename your repo to ``package-future``. Examples: ``reportlab-future``, ``paramiko-future``, ``mezzanine-future``.
16
-
b. Create and activate a virtualenv. Install the package with ``python setup.py install`` and run its test suite on Py2.7 or Py2.6 (e.g. ``python setup.py test`` or ``py.test`` or ``nosetests``)
16
+
b. Create and activate a Python 2 virtualenv. Install the package with ``python setup.py install`` and run its test suite on Py2.7 or Py2.6 (e.g. ``python setup.py test`` or ``py.test`` or ``nosetests``)
17
17
c. Optionally: if there’s a ``.travis.yml`` file, add Python version 3.3 and remove any versions < 2.6.
18
+
d. Install Python 3.3 with e.g. ``sudo apt-get install python3``. On other platforms, an easy way is to use Miniconda3. See `Miniconda3: http://repo.continuum.io/miniconda/index.html`_. Then e.g.::
19
+
20
+
conda create -n py3 python=3
18
21
19
22
.. _porting-step1:
20
23
21
24
Step 1: modern Py2 code
22
25
-----------------------
23
26
24
-
The goal for this step is to modernize the Python 2 code without introducing any dependencies (on ``future`` or e.g. ``six`` at this stage.
27
+
The goal for this step is to modernize the Python 2 code without introducing any dependencies (on ``future`` or e.g. ``six``) at this stage.
25
28
26
29
1a. ``pip install future`` into the virtualenv
27
30
1b. Run ``futurize --stage1 -w *.py subdir1/*.py subdir2/*.py``
0 commit comments