A few days ago Jussi asked me to take a look at the new LP teams that he had created to manage our IRC operators and core channels. I’m not sure if it was due to the lack of caffeine, but I was having a hard time figuring out what the hierarchy of teams was from looking at their launchpad pages. Since I’m now more familiar using launchpadlib, I thought I’d put a small script together to graph out the team relationships. In order to do the actual drawing, I used pydot, which is a python interface for Graphviz.
I showed some test output images to the folks in #ubuntu-offtopic and a few of them thought it was neat and asked me for the code so that they could make their own graphs. I took that as a sign that I should clean up the code to make it more efficient. I also went ahead and used optparse to make the application more user-friendly.
To start, lets take a look at what the output for the teams that Jussi created:
Well that’s rather self-explanatory. Much more so than looking at a bunch of lists on LP.
How if we looked at someone that has administrative access for some Launchpad teams. Perhaps Jono:
Green filled team nodes indicate that the root user has administrative access to them. I chose to focus on what teams a person had control over, rather than which relationships granted that level of access. This was mostly due to not being happy with the options that Graphviz had for shading and coloring edges.
I suppose that graph was somewhat complex… although its nothing compared to sabdfl‘s:
Anyway, the python script itself is available here. And the help page is as follows:
Usage: lpdot.py [-c COLOR] [-a COLOR] [-o PATH] [-d PATH] username
Options:
-h, --help show this help message and exit
-c COLOR set default node color to COLOR (defaults to white)
-a COLOR set administrative node color to COLOR (defaults to greenyellow)
-o PATH write png file to PATH (defaults to pwd)
-d PATH write dot file to PATH
A list of valid colors can be found here:
http://www.graphviz.org/doc/info/colors.html
Read More


