[[TOC]] = 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: * http://eden.sahanafoundation.org/Sahana-Eden.zip or install manually: 1. Install [http://java.sun.com/javase/downloads/widget/jdk6.jsp Java JDK] 2. Install Eclipse (3.6 documented here) * [http://download.eclipse.org/eclipse/downloads/drops/R-3.6.1-201009090800/download.php?dropFile=eclipse-platform-3.6.1-win32.zip Windows] * [http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.6-201006080911/eclipse-platform-3.6-linux-gtk.tar.gz Linux] (or {{{apt-get install eclipse-platform}}}) 3. If using JDK 6u21: [http://wiki.eclipse.org/FAQ_How_do_I_run_Eclipse%3F#Oracle.2FSun_VM_1.6.0_21_on_Windows modify eclipse.ini] 4. Install !PyDev through Eclipse: i. Help menu > Install New Software i. Work with: http://pydev.org/updates i. Add, OK i. tick !PyDev (can exclude the optional !PyDev Mylyn Integration), Next, Next, Accept, Finish i. tick to trust certificate, Restart now 5. Set up the Python Interpreter: i. Window > Preferences > !PyDev > Interpreter - Python i. New, Browse to python26/python.exe, OK, OK 6. Add a new !PyDev Project: i. File > New > Project > !PyDev Project > Next i. untick Use Default i. Browse to the web2py directory i. Give the project a name: "web2py", Next i. untick "Create default 'src' folder and add it to the pythonpath" 7. Debug Configuration: Run > Debug Configurations > Python Run i. Name: Sahana Eden i. Project: Browse to eden i. Main Module: Browse to web2py.py i. Arguments tab: Program Arguments: -a password i. Apply, Debug i. unblock in Windows Firewall Other Installation Guides (should not be required): * http://kollerie.wordpress.com/2009/04/07/setting-up-your-ide-for-web2py-development/ * (Simpler Instructions) http://allisterx.blogspot.com/2009/06/using-web2py-framework-on-eclipse.html === Bzr integration (optional) === * http://wiki.bazaar.canonical.com/BzrEclipse {{{ bzr checkout --lightweight lp:bzr-xmloutput cd bzr-xmloutput python setup.py install cd .. }}} == 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 }}} == Related Links == * [wiki:DeveloperGuidelinesTips#Pythondebugging Debugging Web2Py] ---- DeveloperGuidelines