The web interface of Launchpad is awesome, but it does not provide a function that you can save your search result,
or even create a custom bug display list, I believe managers would like this function, especially they want to track each team member status.
I am just a engineer but also have almost the same requirement,
here are 3 questions I need to answer in the end of weekend.
- Which bugs I worked this week?
- Which bugs I need to work next week?
- Which bugs are waiting me to fix?
It is better to have a way to always show bugs I am interesting for different purpose,
so I start to write a script by using python-launchpadlib.
by the way, another needs is to find bugs and modify attribute(s) of each bug.
python-launchpad
Launchpad has a very friendly python library, I will not talk this too much,
if you want to know the details of it, please check these websites.
lp-cli
lp-cli include several tools which is very small and has only one trivial purpose,
that is users can use Unix pipeline to combine small tools to archive a complex task.
All work of process data of Launchpad can be simplified as the following
- get data from Launchpad
- get sub set of data by some conditions
- do something on each entry one or multiple times
- do something on the final result such as save as a file or print to console
Use Case 1
Create a text file contains bugs I worked is modified this week.
1
2
3
4
| $ lp-searchbugs people ossug-hychen | \
lp-view modified_thisweek | \
lp-print buglist | \
lp-save bugs_modified_thisweek.txt
|
- lp-searchbugs people ossug-hychen – find related bugtask of a user that login name is ossug-hychen
- lp-view modified_thisweek – get bugs worked by ossug-hychen before and modified this week
- lp-print buglist – then print the result in buglist style
- lp-save bugs_worked_this_week.txt – then save the result as a file
the view modified_thisweek means the bug worked by anyone since 7 days before as defined
here
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| ---
data_getters:
...
modified_thisweek:
status: [Fix Committed,
Fix Released,
In Progress,
Incomplete (with response),
Incomplete (without response),
Triaged,
Invalid,
Won't Fix,
Confirmed]
modified_since: $date_before_now
...
|
so if you want to know which bugs is really worked by yourself, we need another
tool to limit the scope of result which is not done yet.
Use Case 2
reassign bugs I fixed in project ABC to another people, some time is QA
1
2
| $ lp-searchbugs project ABC --status 'Fix Committed' --assignee ossug-hychen | \
lp-edit --assignee QA
|
- first command is to get bugs fixed by me in project ABC
- second command is to reassign each bugs to a QA guy
Available Commands
- lp-searchbugs - type:
Fetcher, generate a task of searching bugs in launchpad
- lp-view - type:
View, add extra args to received task (like lp-searchbugs)
- lp-print - type:
Task Action, execute received task and print the result
- lp-save - type:
Action, save STDIN to a file
- lp-mybugs - shortcut of
lp-searchbugs people $your-lp-login-id
because accessing Launchpad takes a lot of time, so the real data fetching
work is only executed in Task Action command in my design.
[update]
Tim Chen told me a cool idea I never think about that you can save STDOUT of lp-searchbugs
, lp-mybugs or lp-view to a text file
1
| $ lp-mybugs | lp-view plan_nextweek > bugs_I_need_to_work_next_week.view
|
next time when you want to get the result, just type
1
| $ lp-print buglist < bugs_I_need_to_work_next_week.view
|
this behavior is similar what lp-view does, so now you can create any view you want!
Installation
1
2
3
| $ add-apt-repository ppa:ossug-hychen/ppa
$ apt-get update
$ apt-get install lp-cli
|
Thanks
The idea of lp-cli is inspired by my friend Thinker Li’s image downloading tool