Searching with Xapian

The Xapian search engine, and associated topics

WSGIWebAPI – web services in Python

leave a comment »

This entry isn’t going to be directly talking about Xapian or searching technologies.  Instead, I wanted to talk about a new Python library, or framework, depending on your point of view, for writing web APIs.

As part of the work I do with Xapian, I’ve been writing a lot of web services recently.  There weren’t any Python frameworks which fulfilled my requirements, so I’ve been implementing the bits I need as I went along.  Last month I spent 4 weeks commuting from Cambridge to London, so I had lots of 40 minute stretches on a train with my laptop, and took the opportunity to knock the bits of code I’d developed into shape, and make a coherent library using them.

The result is WSGIWebAPI.

There are lots of similar frameworks already in Python – two of the most similar to WSGIWebAPI are and WAPI. There’s a good comparison of some of the candidates at Viktor Nagy’s blog.

None of the existing frameworks satisfied my requirements. Partly this is because my biggest requirement was to know that they existed, and when I started implementing my framework I was on a Napoleonic fort, surrounded by sea, two miles from the nearest internet connection, with only 11 other intrepid hackers for company.

More seriously, most of the frameworks I’ve found require or are part of Django, which is a bit heavyweight for the kind of services I write. seems very nice, but isn’t targeted at building web APIs. My main requirement is to have lots of support code available for writing my services, so I don’t have to keep writing the same bits of glue code, but to have everything explicit, and have nothing get in my way. I’m quite happy with what I’ve got so far in WSGIWebAPI, though I’m sure there’s plenty left to do. Hopefully, people will try using it for their projects, and let me know which areas aren’t ideal for them.

One particularly nice feature is that APIs written in WSGIWebAPI can be automatically documented, using information from documentation comments to explain the purpose behind each method, but also hooking into the validation framework to display lists of possible parameters. The documentation output could do with being clearer, but the basic functionality has already been useful in one client job, where I was using a pre-release version of WSGIWebAPI to build APIs very quickly, and was able to share the up-to-date documentation with other team members as soon as the API was working.

My next plan is to use WSGIWebAPI to improve a Xapian search server (also written at the fort), so hopefully my next post will be to announce progress with that!


Written by richardboulton

February 2, 2009 at 8:11 pm

Posted in WSGIWAPI

Tagged with , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: