Version 47 (modified by Pat Tressel, 13 years ago) ( diff )


Developer Guidelines - Eclipse

Eclipse is a full IDE supporting Debugging & Code Completion.

PyDev is an Eclipse module which supports Python.


An Eclipse install with PyDev included is available in the 75Mb zip file which also includes Web2Py & Eden:

or install manually:

  1. Install Java JDK
  2. Install Eclipse (setup for 3.6 is documented below):
    • Look for "Latest release" on the downloads page.
    • (For Linux, and also apt-get install eclipse-platform but may get old version.)
  3. If using JDK 6u21: modify eclipse.ini
  4. Install PyDev through Eclipse:
    1. Help menu > Install New Software
    2. Work with:
    3. Add, OK
    4. tick PyDev (can exclude the optional PyDev Mylyn Integration), Next, Next, Accept, Finish
    5. tick to trust certificate, Restart now
  5. Recommend installing Psyco to speed-up Python in Eclipse:


  1. Set up the Python Interpreter:
    1. Window > Preferences > PyDev > Interpreter - Python. Click New
      1. On Windows: Browse to python26/python.exe (or python27/python.exe if using 2.7), OK, OK
      2. On Linux: "python" is the name of the interpreter, the location is "/usr/bin/python", OK, OK
  2. Add a new PyDev Project:
    1. File > New > Project...
    2. Open the PyDev folder, and choose PyDev Project
    3. Give the project a name "web2py"
    4. Un-tick "Use Default"
    5. Grammar Version (should be 2.6 in the Linux VM)
    6. Browse to the web2py directory (on the Linux VM, this is in /home/web2py)
    7. Un-tick "Create default 'src' folder and add it to the pythonpath"
    8. Click Finish
    9. Click "No" when asked to open the perspective
  3. Debug Configuration:
    1. From the Run menu, choose Debug Configurations...
    2. Double-click Python Run
    3. On the Main tab: Name: Enter (e.g.) web2py
    4. Project: Select web2py (should be the only option)
    5. On the Main tab: Browse to (on the Linux VM, this is /home/web2py/
    6. On the Arguments tab: Type in the program arguments: "-a password" (Choose a password for web2py and substitute it for "password".)
    7. Click Apply. Close the configuration window.
    8. In the PyDev Package Explorer tab, click web2py to select it. (Without this, you will get an error saying $project_loc is empty. This is an Eclipse issue.)
    9. In the toolbar below the main Eclipse menu bar, find the bug icon and click the down-arrow next to it. Click the option that has a "P" superscript, which executes the Python command line we just set. (The option with a "U" runs unittests, which are not what we want now.)
    10. On Windows: If asked, unblock in Windows Firewall (not necessary on the Linux VM).
  1. Miscellaneous suggestions for comfort and convenience:
    1. Right-click on Java perspective in top-right & select Close
    2. Window > Open Perspective > Other > Debug
    3. Window > Show View > Expressions
    4. Window > Show View > Expressions > Other > PyDev > PyDev Package Explorer
      (This is where you will need to select web2py before trying Run or Debug to avoid the empty $project_loc error.)
    5. Drag the Expressions, Console, Tasks tabs to the upper right, where the Variables tab is. Drag PyDev Package Explorer to the upper left where Debug is. (This leaves more space for the editor view.)
    6. Window > Customize Perspective > Go through the tabs and untick PyDev Debug. Click OK
    7. Set your default HTML editor
      1. From the Window menu, choose Preferences
      2. Under General section on the left
      3. Open the Editors section
      4. Choose File Associations
      5. Highlight .htm
      6. Click "Add..."
      7. Choose "Text Editor"
      8. Click OK
      9. Repeat the process with .html
      10. Click OK
    8. Window > Preferences > General > Editors > Text Editors
      • tick Show line numbers
      • tick Show Print Margin and set the margin to 80 (to assist in our vain attempt to keep within that width)
    9. Window > Preferences > General > Workspace
      • tick 'Refresh on access'
      • untick 'Build automatically'
    10. You may want to change the layout of the window by dragging sections to convenient regions of the window and resizing them. Combine less-used sections as tabs in the same region.

Debugging with Eclipse

  • Set and remove breakpoints by double clicking in the margin of the code file
  • Click the 'Debug Sahana Eden' button
  • F5 Step into functions
  • F6 Step over lines
  • F7 Step out of functions
  • Use expressions (drag and drop from code) or right-click > watch

Accessing private data

Some data is marked as private to let other developers know they shouldn't access this directly

  • e.g. in we have S3Resource.__set & S3Resource.__query

This then means that Eclipse can't see these attributes as self.__set, etc.

Instead need to use:




Bzr integration (optional)

Other Configuration Guides (should not be required):


Note: See TracWiki for help on using the wiki.