Difference between revisions of "Python3"

From Nsnam
Jump to: navigation, search
(Tasks)
(Tasks)
 
(One intermediate revision by one other user not shown)
Line 17: Line 17:
 
# All python programs in the documentation directories (e.g. conf.py)
 
# All python programs in the documentation directories (e.g. conf.py)
 
# All scripts in ns-3-allinone (build.py dist.py download.py)
 
# All scripts in ns-3-allinone (build.py dist.py download.py)
# src/create-module.py
+
# <s>src/create-module.py</s>
 
# utils.py
 
# utils.py
# utils/check-style.py
+
# <s>utils/check-style.py</s>
 
# utils/grid.py
 
# utils/grid.py
 
# utils/python-unit-tests.py
 
# utils/python-unit-tests.py
Line 36: Line 36:
  
 
The following still needs to be done:
 
The following still needs to be done:
* ns-3-allinone/dist.py
+
* See above Task list for items not yet crossed off
 
* Siddharth Santurkar has volunteered to port bake
 
* Siddharth Santurkar has volunteered to port bake
 
* We don't have anyone working on Python API scanning toolchain (please contact us if you want to work on this)
 
* We don't have anyone working on Python API scanning toolchain (please contact us if you want to work on this)

Latest revision as of 17:41, 5 July 2016

Main Page - Current Development - Developer FAQ - Tools - Related Projects - Project Ideas - Summer Projects

Installation - Troubleshooting - User FAQ - HOWTOs - Samples - Models - Education - Contributed Code - Papers

This page is tracking Python3 compatibility for ns-3 and related projects. As of ns-3.23 (May 2015), only Python2 (2.7 series) is supported.

Goals

Make ns-3 and related projects (bake build system, pyviz visualizer) compatible with both Python 2.7 and 3.4.

Tasks

The following ports for basic ns-3 operation need to be accomplished (if found incompatible with Python3):

  1. All scripts for the waf build system (waf-tools, wutils.py, etc.)
  2. All ns-3 python programs (e.g. first.py)
  3. src/visualizer
  4. The test.py test runner program
  5. All python programs in the documentation directories (e.g. conf.py)
  6. All scripts in ns-3-allinone (build.py dist.py download.py)
  7. src/create-module.py
  8. utils.py
  9. utils/check-style.py
  10. utils/grid.py
  11. utils/python-unit-tests.py

Pdbarnes (talk) What about the Rietveld upload.py script used for code review? This is their issue #486

tomh (talk) In my opinion, would be nice to have but I don't plan to put priority on this right now as it can easily be run with python2 on a one-time basis

Also, the bake build system must be ported.

Also, the Python API scanning process needs to be upgraded. This relies on third party tools (particularly pygccxml and pybindgen) that need to be investigated.

Status

ns-3.24 contains support for Python 3 in Waf, download.py, build.py, and test.py.

The following still needs to be done:

  • See above Task list for items not yet crossed off
  • Siddharth Santurkar has volunteered to port bake
  • We don't have anyone working on Python API scanning toolchain (please contact us if you want to work on this)

Testing

Python3 can be tested on most Linux systems using the virtualenv system.

If you have 'pip' installed, you can install virtualenv as follows:

 $ sudo pip install virtualenv

Then, the following steps are recommended:

 $ mkdir my_project_folder && cd $_
 $ hg clone http://code.nsnam.org/ns-3-allinone
 $ cd ns-3-allinone
 $ /usr/bin/python2.7 download.py
 $ hg clone http://code.nsnam.org/tomh/ns-3-dev-python3
 $ virtualenv -p /usr/bin/python3 venv
 $ source venv/bin/activate

Your prompt should now look like this, prepended with '(venv)':

 (venv)buildslave@slave-ubuntu-15:~/my_project_folder/ns-3-allinone$

Now you are in a special environment for which any calls to 'python' will use the python3 version. To see this, try calling:

 (venv)buildslave@slave-ubuntu-15:~/my_project_folder/ns-3-allinone$ python -V

To drop out of this virtualenv, type:

 $ deactivate

You may also consider to run the test-test.py and test-waf.py programs (which unit test the test.py and waf programs and their options) found in ``utils/tests/`` directory.