wiki:DeveloperGuidelines/Eclipse

Version 28 (modified by Michael Howden, 11 years ago) ( diff )

--

Eclipse

Eclipse is a full IDE supporting Debugging & Code Completion.

PyDev is an Eclipse module which supports Python.

Installation

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 (3.6 documented here)
  3. If using JDK 6u21: modify eclipse.ini
  4. Install PyDev through Eclipse:
    1. Help menu > Install New Software
    2. Work with: http://pydev.org/updates
    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. Set up the Python Interpreter:
    1. Window > Preferences > PyDev > Interpreter - Python
    2. New, Browse to python26/python.exe, OK, OK
  6. Add a new PyDev Project:
    1. File > New > Project > PyDev Project > Next
    2. untick Use Default
    3. Browse to the web2py directory
    4. Give the project a name: "web2py", Next
    5. untick "Create default 'src' folder and add it to the pythonpath"
  7. Debug Configuration: Run > Debug Configurations > Python Run
    1. Name: Sahana Eden
    2. Project: Browse to eden
    3. Main Module: Browse to web2py.py
    4. Arguments tab: Program Arguments: -a password
    5. Apply, Debug
    6. unblock in Windows Firewall
  8. If you want a HTML and JS editor (with syntax highlighting) in Eclipse:
    1. Help menu > Install New Software
    2. Work with: http://download.eclipse.org/releases/helios
    3. Add, OK
    4. Select {{{Web, XML and Java EE Development}}
    5. Select Web Tool Platform(?)
    6. tick to trust certificate, Restart now

Other Installation Guides (should not be required):

Bzr integration (optional)

Configuration

  • Right-click on Java perspective in top-right & select Close
  • Window menu > Open Perspective > Other > Debug
  • Window menu > Show View > Expressions
  • right-click on toolbar > Customise Perspective > untick PyDev Debug, Run & External Tools
  • Window menu > Preferences > General > Editors > File Associations > *.html
    • Add (lower one), Text Editor, OK, Default, OK
  • Windows > Preferences > General > Editors > Text Editors > tick Show line numbers

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 s3xrc.py we have S3Resource.__set & S3Resource.__query

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

Instead need to use:

xxx._ClassName__AttributeName

e.g.:

resource._S3Resource__query
resource._S3Resource__set

DeveloperGuidelines

Note: See TracWiki for help on using the wiki.