Edgewall Software

Version 1 (modified by jtiai, 16 years ago) ( diff )

initial version.

How to develop Trac with Eclipse PyDev

Installation

Install Eclipse (3.3 or newer will do) and pydev. Also either subclipse or subversive is good to have.

  1. Install prerequisities, at least Genshi
    $ easy_install genshi 
    
  1. You can check out the trac sources inside eclipse using either the subclipse or the subversive plugin.
  1. Then build the setuptools info file from the command line
    $ set PYTHONPATH=c:\path\to\your\trac\sources
    $ python setup.py egg_info
    
  1. Create a trac environment, e.g.
    $ trac-admin /path/to/myproject initenv 
    

This is of course a bit tricky if you don't have trac installed in system so workflow is a bit different:

$ set PYTHONPATH=c:\path\to\your\trac\sources
$ python
>>> import trac.admin.console
>>> trac.admin.console.run(['/path/to/myproject', 'initenv'])
  1. In Eclipse, make sure that the PYTHONPATH in the project properties dialog includes the sources for trac.
  1. Create an initial run configuration by clicking right on trac/web/standalone.py file, and choosing Run As→Python Run.

trac will complain that no environment has been set.

  1. Select Run→Open Run Dialog… and set the correct command line arguments in the arguments tab, eg.

—port 8000 /path/to/myproject (Note that the option —auto-reload will cause tracd to restart every time source code has been changed, but it seems to prevent debugging with pydev. Does someone has a clue?)

  1. You should now be able to run tracd, as well as to debug it using the same run configuration. To run the test cases, just click on a test folder and select Run→Python unit tests
  1. To debug a plugin, deploy it into your test environment via $ python setup.py develop -md /path/to/projenv/plugins and then start the run configuration from above.

If you are experiencing troubles in debugging Trac code, make sure that PYTHONPATH in project properties doesn't contain pointers to other Trac sources. Otherwise those sources will be picked instead checked out.

Thanks

Originally these instructions were posted on trac-dev list by Stanley Williams.

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.