enough water makes all rocks round

PythonDoc Wiki Macro for Trac

In a time long, long ago in a cubicle far, far away, I once wrote a wiki macro for Trac to generate documentation from python modules in a Subversion repository using PythonDoc.

I’m embarrassed to tell you the original version took almost a full day to write. Dynamic language productivity, indeed! But I’m equally pleased to also tell you that this version, the one you can download here, only took an hour or so.

To be fair, this version uses a newer version of Trac, which has lots of goodies exposed for dealing with the underlying repository. The original took so long mostly because of my infamiliarity with the python svn extension.
But enough blabbing. Grab the file and drop it into your Trac instance wiki-macros directory. Be sure to install PythonDoc, and then use it in your wiki pages like so:

Documentation from latest revision:
[[TracPythonDoc(trunk/harold/publishers/kidtemplate.py)]]

Documentation from rev 42:
[[TracPythonDoc(trunk/harold/publishers/kidtemplate.py, 42)]]

See it in action [here](http://trac.cleverharold.org/wiki/PublishersApiDocs).

Last but not least, please keep in mind that this is brand new code, not well tested, may change soon, yada-yada. But please do enjoy!

**Update 6-16:**

With a little prompting from Kevin, I’ve modified the macro to generate links to the source code browser where appropriate.

Files:

* [TracPythonDoc.py](/files/TracPythonDoc.py)

Advertisements

Comments are closed.