Trac 0,11 Custom Workflows - Getting started and testing your workflow.

I've been meaning to write this up for a while, but just don't seem to get around to it.

Custom workflows in Trac 0.11 are probably the coolest new feature in it. That and the supremely easy install and upgrade facilities via the python setuptools, easy_install command. Trac 0.11 Install Whilst I do love how easy installing trac has become that even Big Mad Kev can install it ;oD, this isn't about configuring trac with apache and svn. You can find that out from Andy Allan's posts, as well as my own "svn for idiots" post and from the Edgewall wiki, so I'll shut up and crack on.To build your own trac workflows you are going need a few things.
Firstly, you're going to need to have Python and Trac installed.
Secondly, I highly recommend installing GraphVis
Lastly, you will at least need the contrib/workflow folder out of the trac svn trunk folder.

Starting with the last of these; why do you need this? and how do I get it?
The why is because there are some example workflows and a couple of utilities.
The how is from the command line like this :

view plain print about
1svn export workflow
This will export the workflow folder from the trac repo into a folder called "workflow" under the folder you are currently in.
You need to have subversion installed to run this command line or you can simply point subclipse or subversive in eclipse at the trac repository and pull the folder into eclipse.

One of the utilities is "showworkflow". This is a handy utility is you're on *nix as it will generate a graphical representation of your workflow in a PDF. This requires that you have graphviz, that I mention above, installed.
If you're on windows, don't worry. The other utility in the contrib folder is a python script called This utility is the reason why I say you need Python and Trac installed. Running this script against your workflow will generate a file that you can give to graphviz, which will then generate a visual representation of your workflow in any number of file types.
This script, unfortunately, isn't standalone and does import a couple of elements from your trac installation, so you will need python and trac available to run it.

Here's how to call the workflow parser:

view plain print about
1python simple-workflow.ini >
You need to pass in the ini file and pipe the output to a file. By default streams the file to the console.

Having installed GraphViz, you'll find a three utilities available to you; dot, neato and twopi. They all seem to me to give pretty much the same output, but dot seems to give the clearest layout. Open up dot and you'll get a utility that looks like this.

GraphViz dot utilty

You don't have to do a lot with this. In the input file box, browse to the dot file you created from your workflow ini file. In the output file box put the name and path of where you want your visualisation to be saved. Select the output file type you want - I tend to use jpg, png or gif depending on which way the wind is blowing on the day.

Having set up the input, output and the type of output, click on "do layout" and hey presto your output file will be created. Here's one I made earlier using the example simple-workflow.ini

Generated Simple work visualisation

These visualisations help greatly to see exactly what the paths through your workflow are going to be and is invaluable with testing the ini file, as the workflow_parser will throw and error if there is something wrong

Ok - So I feel like that's quite enough for one blog entry, before it gets to be TLDR. I'll write another entry shorly about actually creating and editing workflows.

In the meantime, take a look at the contents of the example ini files in the contrib/workflow folder, generate the diagrams for them and you might also want to take a bit of a look at

Hi, this is an interesting article, but it seems to be chopped up at the bottom :-(

# Posted By alecu | 3/9/09 9:41 AM