views:

960

answers:

4

I'm trying to write my first little plugin for Trac and am kind of lost as to what the API exactly is. For example, exactly which fields are offered for "ticket" objects, among many other things.

Does anyone know of a good place to look for Trac API documentation? Can't find anything on the web site but maybe I'm just looking wrong...

+2  A: 

http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture is a start.

Epaga
+5  A: 

The component architecture is important, but the real starting page for development is: http://trac.edgewall.org/wiki/TracDev

Have also a look at the trac-hacks web site http://trac-hacks.org/ This is really a good source of examples, and many times you will find something close to what you want to do, that you can simply adapt from.

Think also about installing this development plugin: http://trac-hacks.org/wiki/TracDeveloperPlugin It makes it much easier to debug your plugin with it

Mapad
+2  A: 

It's all in Trac's Trac!

The pages on plugin development and the component architecture give a good overview. Unfortunately, I can't find any API documentation. Your best bet is to 'use the source'. Check out the Ticket.py file for the Ticket class. If you would rather query the database directly, look at the database schema.

andypaxo
+2  A: 

Each component of Trac has an api.py that's loaded with docstrings on all the interfaces you can implement. I've found them to be extremely valuable when implementing my own plugins.

For example:

http://trac.edgewall.org/browser/trunk/trac/ticket/api.py

or

http://trac.edgewall.org/browser/trunk/trac/wiki/api.py

are two API's I've often used. Another thing I often do is look for existing plugins on TracHacks which implement features I'd like in my plugin and just rip out the useful bits of those.

Kamil Kisiel