This week in Launchpad’s web API
This status report was put off until today because the edge site was frozen. This update is huge. We’ve made one change to launchpadlib, exposed a whole lot of Launchpad’s project registry, and published branches for the first time.
Since the development cycle is over, the next update will probably be in two weeks.
Team restriction lifted
You no longer need to be a member of the beta testers team to use the web service. We decided that the restriction didn’t make sense, given that nobody’s going to use the web service by accident. This doesn’t mean that the web service is out of beta; we’ll make a much bigger deal of it when that happens.
launchpadlib
I fixed a longstanding annoyance in launchpadlib. This code will now work:
>>> launchpad.projects['firefox'].releases[0]
Previously you would have had to slice the list and then index the slice:
>>> launchpad.projects['firefox'].releases[:1][0]
New Top-Level Collections
We’ve published the list of project groups as a new top-level collection.
>>> launchpad.project_groups['mysql'].name
u'mysql'
>>> [group.name for group in launchpad.project_groups[:2]]
[u'launchpad-project', u'aep']
>>> [group.name for group in launchpad.project_groups.search("mysql")]
[u'tx', u'wordpress-project', u'samba-project', u'openarchaeology',
u'mysql', u'linterra']
We’ve also published the list of distributions.
>>> launchpad.distributions['ubuntu'].name
u'ubuntu'
>>> [distro.name for distro in launchpad.distributions][:2]
[u'ubuntu', u'elbuntu']
The Pillar Set
We’ve published the Launchpad pillar set. This is a pretty confusing name but we haven’t found a better one yet. “Pillar” is a generic term that encompasses project, project group, and distribution. If you go to the Launchpad homepage you’ll see a list of “Featured projects”. These are actually featured pillars: Extreme Tux Racer is a featured project, MySQL is a featured project group, and Ubuntu is a featured distribution. You can get access to the list of featured pillars with code like this:
>>> [pillar.name for pillar in launchpad.pillars.featured_pillars[:5]]
[u'anewt', u'awn', u'bauble', u'bzr', u'do']
You can also use the pillar set to do a unified search across projects, project groups, and distributions. A search for ‘ubuntu’ will pick up the ‘ubuntu’ distribution, the ‘ubuntu-live-support’ project group, and the ‘ubuntu-dev-docs’ project.
Unlike with, say, the bug set, you can’t just grab a bunch of pillar objects from inside launchpad.pillars
. The only interesting things about launchpad.pillars
are the things beneath it: the pillar search and the list of featured pillars.
Branches
The code team has done some web service work, and you can now get basic information about a project’s registered bzr branches.
>>> branch = launchpad.projects['firefox'].branches[0]
>>> branch.title
u'Firefox Trunk Package'
>>> branch.owner.name
u'asac'
Other Newly Published Objects
We now publish a project’s release series, releases, and the files associated with those releases.
>>> release_series = launchpad.projects['firefox'].series[1]
>>> release_series.title
u'Mozilla Firefox Series: 1.5'
>>> release = release_series.releases[0]
>>> release.version
u'1.5.0.2-source'
>>> release_file = release.files[0]
>>> release_file.date_uploaded
u'2006-10-23T09:26:47.228605+00:00'
>>> release_file.file.open().read()
[binary data]