Dev Week -- Launchpad Hacks - Brian Murray -- Tue, Sep 2

(04:03:15 PM) bdmurray: Hi, I'm Brian Murray and Ubuntu's Bugmaster.
(04:03:30 PM) bdmurray: As a member of Ubuntu's QA team I tend to use Launchpad quite a lot and sometimes I want to perform actions or see things that aren't currently available in the user interface.
(04:03:41 PM) mcas is now known as mcas_away
(04:04:22 PM) bdmurray: Or maybe shouldn't be available.
(04:04:28 PM) bdmurray: Subsequently, I maintain a couple of projects, python-launchpad-bugs and launchpad-gm-scripts, for hacking Launchpad.
(04:05:16 PM) bdmurray: I want to start off talking about launchpad-gm-scripts as it is relatively new and there is some exciting stuff going on there.  So much exciting stuff I might not make it to python-launchpad-bugs.
(04:05:43 PM) bdmurray: The launchapd-gm-scripts project,, is a collection of Greasemonkey scripts that modify the look and behavior of Launchpad.
(04:06:13 PM) bdmurray: In case you don't know greasemonkey is a Firefox extension that allows scripts to make changes to how HTML web pages are rendered.
(04:06:27 PM) bdmurray: In some cases you can actually see the changes happen as the page will load, the script will run and then the page will change.
(04:06:42 PM) bdmurray: Greasemonkey has been available as a package, firefox-greasemonkey, since Feisty.
(04:07:18 PM) bdmurray: The scripts in launchpad-gm-scripts are available via bzr, bzr branch lp:launchpad-gm-scripts, or it is possible to browse the project's code and install scripts without getting the whole project.
(04:07:38 PM) bdmurray: For example, going to we can click on the green arrow on the far right of the lp_hide_tags.user.js row and be presented with a Greasemonkey dialog to install the script.
(04:08:10 PM) bdmurray: All the scripts end with 'user.js' and are written in javascript.
(04:08:22 PM) bdmurray: As you can see we have collected quite a few of these scripts!
(04:08:38 PM) bdmurray: Therefore, I'll just briefly go over their features.
(04:08:47 PM) bdmurray: More information is available in the README file of the bzr tree.
(04:08:56 PM) bdmurray: Are there any questions so far?
(04:10:09 PM) bdmurray: I recently added, well it was today, the lp_activity_comments script from Markus Korn.
(04:10:30 PM) bdmurray: This script is incredibly useful as it displays information from a bug's activity log directly on the bug report and avoids your having to click the "Activity log" link and wait for another page to load.
(04:10:49 PM) bdmurray: This allows you to view information about who changed a bug's status or importance and when they changed it.
(04:11:03 PM) bdmurray: The activity shows up either in the comment the change happened in or as a separate pseudo-comment.
(04:11:11 PM) bdmurray: A screenshot of the change is visiable at
(04:11:32 PM) bdmurray: Notice in the first comment that Markus changed the bug's status from Confirmed to In Progress and in the last one I changed it from In Progress to Fix Released.
(04:12:12 PM) bdmurray: For quite a while we've had the lp_button_tags script, written by Bryce Harrington, which allows you to add tags to a bug report without loading the "+edit" page for the bug report.
(04:12:30 PM) bdmurray: A screenshot is at near the cursor there is the text "Add tag:" followed by a list of tags.
(04:12:58 PM) bdmurray: These tags are statically set in the script itself, however they are in a section surrounded by a "User settable data" comment so they are easily modified.
(04:13:19 PM) bdmurray: Additionally, when you mouse over a tag you are presented with a tip regarding when to use the tag.
(04:14:12 PM) bdmurray: Does anyone want to know how to modify that the tags in that script?
(04:14:47 PM) chombium: QUESTION: Can the the tags be read/loaded from some global launchpad tag set?
(04:15:20 PM) chombium: if there is any
(04:15:50 PM) bdmurray: chombium: I haven't looked at that.  We do have, however that list is quite long.
(04:16:27 PM) bdmurray: One thing we'd like to do with this script is have the tags be package specific, so if you were looking at an openoffice bug it would show openoffice tags.
(04:17:09 PM) chombium: that would be great
(04:17:29 PM) bdmurray: Okay, I'll look at that again
(04:17:33 PM) bdmurray: < stefanlsd> QUESTION: What would be the best way to watch bzr  for updates to the scripts?
(04:18:10 PM) bdmurray: stefanlsd: It is possible to subscribe to the master branch
(04:18:32 PM) bdmurray: So you'd get e-mail announcements when something is committed.
(04:18:53 PM) bdmurray: Additionally, I also try to blog about new scripts.
(04:19:21 PM) bdmurray: Moving on we have one of the first greasemonkey scripts in the project was lp_karma_suffix by Kees Cook.
(04:19:38 PM) bdmurray: With this script enabled three things are appened to a Launchpad user's name in various places.  1) Their launchpad id 2) Their current value of their karma and 3) The icons of select teams of which they are a member.
(04:20:24 PM) bdmurray: This infomration is appended to the reporter, assignee and commenters.
(04:20:31 PM) bdmurray: in a bug report.
(04:20:59 PM) bdmurray: It is particularly useful when viewing a bug report with lots of comments as guide to distinguish specific comments.
(04:21:18 PM) bdmurray:  You can see what it looks like at
(04:21:31 PM) bdmurray: In case you aren't intimately familiar with the team icons you can find out the team name by mousing over the icon.
(04:22:18 PM) bdmurray: Looking at the screenshot you'll notice Sebastien Bacher is a member of quite a few teams including ubuntu-dev.
(04:22:37 PM) bdmurray: This script is also modifiable and you can easily change which team's icons appear.
(04:22:58 PM) bdmurray: Another script that modifies bug comments is lp_reporter_comments written by me.
(04:23:11 PM) bdmurray: This script changes the heading of a comment to a light grey color if it is from the bug's reporter.
(04:23:29 PM) bdmurray: I also find this quite useful when looking at bug reports with lots of comments.
(04:23:38 PM) bdmurray: Screenshot -
(04:23:54 PM) bdmurray: Notice how David's comments have a grey header and mine is the standard color.
(04:24:33 PM) bdmurray: It's quite easy to change the color in that too if you want something more obvious.  I went with subtle for the generic script.
(04:24:56 PM) bdmurray: A script I think you'll find useful as a developer or potential developer is the lp_patches script which I also wrote.
(04:25:11 PM) bdmurray: This script checks every attachment of a bug report to see whether it is flagged as an attachment.
(04:25:23 PM) bdmurray: Without this script you'd have to click on the "edit" link next to an attachment and look to see if the "This is attachment is a patch" is checked.
(04:25:38 PM) bdmurray: This script will do that for you and modify the icon next to the attachment, normally a green down arrow, to a star.
(04:25:50 PM) bdmurray: A screenshot of this change is at
(04:26:20 PM) bdmurray: You can see both in the first comment and the attachments portlet on the right hand side that add_assignment_counting.diff is flagged as patch.
(04:26:31 PM) bdmurray: because it has the star icon.
(04:27:14 PM) bdmurray: Occasionally, people will mark attachments as patches when they are not.
(04:27:50 PM) bdmurray: If you find one of these please help by clicking the "edit" hyperlink next to the attachment and unset the flag.
(04:28:24 PM) bdmurray: Quite a few people and workflows rely on Launchpad's ability to search for patches and these false positives are disruptive.
(04:28:50 PM) bdmurray: < stefanlsd> QUESTION: I love alot of this functionality - but  shouldnt some of it be offered by LP? Does LP plan  on using some of these ideas?
(04:29:27 PM) bdmurray: Yes, some of these scripts have bug reports about Launchpad associated with them - for example lp_karma_suffix.
(04:30:20 PM) bdmurray: However, it is hard to determine which teams to display and in which context. We, the launchpad-gm-scripts developers, just made an arbitrary decision based off what was useful to us.
(04:31:03 PM) bdmurray: Some things like lp_reporter_comments haven't been submitted as bugs about Launchpad but probably should be.
(04:31:50 PM) bdmurray: The launchpad-gm-scripts can be a useful testing ground for some of these features and a way to gauge interest in them.
(04:32:58 PM) bdmurray: If there is a particular script you feel should be implemented in Launchpad please ping me and as I might know if there is already a bug about it.
(04:33:18 PM) bdmurray: Back to the scripts
(04:33:28 PM) bdmurray: The first greasemonkey script I'm aware of is lp_stockreplies originally written by Tollef Fog Heen.
(04:33:48 PM) bdmurray: The one in the current branch is Kees's and it  provides a system for storing standard responses and actions to bug reports and reusing those responses.
(04:34:05 PM) bdmurray: You can add as many responses as you want (I think) and by clicking on a pseudo-url have the comment field prefilled, and modify the bug's status, importance, assignment or package.
(04:34:25 PM) bdmurray: You can see what it looks like at
(04:34:44 PM) bdmurray: This information is presented to you when you click on the downward cheveron next to a bug's package, status, importance or assignment.
(04:35:05 PM) bdmurray: If the bugs you deal with have some patterns to them (where certain actions are repeated) I can't recommend this enough - it is a phenomenal time saver.
(04:36:23 PM) bdmurray: Iif you look at all the Ubuntu bug reports ( quite a lot have been used at one point in time or another by very few bugs.
(04:36:36 PM) bdmurray: Subsequently, the "Tags portlet" on the right hand side may not be that useful.  I have good news though!
(04:36:53 PM) bdmurray: Markus wrote another greasemonkey script that sorts the list by quantity of appearances and limits the number of tags that appear in the portlet.
(04:37:07 PM) bdmurray: Again, this is configurable by directly editing the script and reinstalling it.
(04:37:19 PM) bdmurray: A screen shot of what the "Tags portlet" looks like with the script enabled is at
(04:37:47 PM) bdmurray: You can see the tags applet near my cursor.
(04:38:00 PM) bdmurray: With it enabled it is much easier to discover that 200! bugs are tagged likely-dup.
(04:39:05 PM) bdmurray: We even have a script that was contributed by a Launchpad developer (Gavin Panella) - lp_highlight_me.
(04:39:19 PM) bdmurray:  This script helps you identify milestones that are assigned to you for a project which is quite useful when you have a project, like Ubuntu, with a lot of bugs milestoned.
(04:39:31 PM) bdmurray: Screenshot -
(04:40:16 PM) bdmurray: Okay, that covers the majority of the scripts in the launchpad-gm-scripts project.  Are there any questions?
(04:41:17 PM) bdmurray: In addition to subscribing to the bzr branch - I'll also try and use Launchpad's announcement feature,, to talk about new scripts or features.
(04:41:37 PM) bdmurray: If you have any bugs with these scripts we use Launchpad as our bug tracker so please submit a bug via
(04:41:52 PM) bdmurray: Also feel free to submit a bug if you have an idea of a new greasemonkey script that'd be useful.
(04:44:21 PM) bdmurray: QUESTION: How do i add paragraphs to the  stock-replies-script? Escape-Sequences don't seem to  work.
(04:44:30 PM) bdmurray: from Ampelbein
(04:44:50 PM) bdmurray: Uh, well you caught me!  I don't actually use that one but will find out for you.
(04:45:39 PM) bdmurray: You might try '\n' though
(04:46:42 PM) bdmurray: So I also work on python-launchpad-bugs.
(04:46:51 PM) bdmurray: python-launchpad-bugs is a collection of classes for reading and modifying bug reports in Launchpad, it predates the Launchpad API so currently utilizes screenscraping and can be somewhat fragile.
(04:47:11 PM) bdmurray: However, it has a large user base is quickly updated to deal with changes.
(04:47:27 PM) bdmurray: py-lp-b provides some features that don't currently exist in Launchpad.
(04:47:40 PM) bdmurray: The project is hosted on Launchpad,, and its code is availabe via a bzr tree and it is packaged for Ubuntu.  There isn't enough time to cover everything you can do with it but I did want to share a couple of features.
(04:48:19 PM) bdmurray: I was on holiday the past four days and have a lot of e-mail to deal with, but let's say I'm interested in which xserver-xorg-video-ati bugs were recently set to a status of Confirmed or Triaged.
(04:48:34 PM) bdmurray: There happens to be a script in the examples directory of python-launchpad-bugs that searches for package bugs confirmed since a specific date.
(04:49:10 PM) bdmurray: Executing it via 'python xserver-xorg-video-ati 2008-08-28' I find out that bug 261929 was confirmed while I was away.
(04:49:36 PM) bdmurray: There is also a script for filtering on date triaged.
(04:49:57 PM) bdmurray: I think these are both quite handy as Launchpad doesn't provide a way of searching by date yet.
(04:50:20 PM) chombium: really handy indeed
(04:51:51 PM) chombium: QUESTION: when can we expect this functionality to be implemented in LP?
(04:52:12 PM) bdmurray: With python-launchpad-bugs you can do a phenomenal number things including filtering on bugs and modifying bugs quickly and easily.  We've recently done some calls for testing via py-lp-b and commented on large quantities of bugs.
(04:52:52 PM) bdmurray: chombium: The Launchpad team is actively developing there list of goals for 3.0 and I'm not certain where date searching fits in exactly.
(04:53:15 PM) bdmurray: However, I do belive it is on the list.
(04:53:33 PM) bdmurray: Another project for hacking Launchpad is bughelper.
(04:53:47 PM) bdmurray: Bughelper  uses python-launchpad-bugs and provides many other types of searches.
(04:53:58 PM) bdmurray: Using 'bugnumbers -p python-launchpad-bugs --branch --parsemode=html' I can find the bug numbers of the py-lp-b bug reports that have a branch attached to them, which can be quite handy.
(04:54:47 PM) bdmurray: For easily identifying bugs to fix and merges to make.
(04:55:04 PM) bdmurray: I'm running short on time though...
(04:55:14 PM) bdmurray: This is really just a small sampling of what you can do with bughelper and python-launchpad-bugs though and you can find out from the logs of the last class Markus and I gave on it at
(04:56:22 PM) bdmurray: I've covered some ways that Launchpad is currently being hacked and I hope that you find some of these hacks useful in your day to day usage of Launchpad.
(04:56:31 PM) bdmurray: Are there any more questions?
(04:58:43 PM) bdmurray: Well, thank you everyone for coming and happy hacking.
(04:58:56 PM) thekorn_: thanks brian
(04:59:02 PM) mok0: thanks!!
(04:59:17 PM) bobbo: thanks bdmurray
(04:59:27 PM) chombium: thanks brian, very useful tips

MeetingLogs/devweek0809/LaunchpadHacks (last edited 2008-09-02 22:38:04 by ausimage)