Present Perfect


Picture Gallery
Present Perfect

paisley: CouchDB for Twisted

Filed under: couchdb,Hacking,Python,Twisted — Thomas @ 20:17


Now that I want to write a Maemo UI for my GTD application, I need to address the fact that python-couchdb is written using a blocking model.

On Launchpad, I found Paisley a while ago - a CouchDB client library using Twisted. Seemed functional enough, but I was using the 'schema' stuff from python-couchdb which allows you to define a class with typed properties and map CouchDB documents onto them, and Paisley didn't seem to have any of that. In fact, Paisley seemed to have about 10 commits to it, all done over a year ago.

I had two possible approaches. One was to just use python-couchdb together with threads. It's a typical solution to this problem, and one that is an evolutionary dead-end as far as I'm concerned. However, it would have allowed me to focus on the UI today instead.

The other approach was to see how to map python-couchdb concepts onto paisley.

(I actually considered a third approach - using Rodrigo's couchdb-glib library - except that it seems to also be blocking at this point, so I'd have to fix that, and make python bindings or figure out introspection stuff. So I dropped that idea.)

So, after some IRC discussion between me and cmlenz (author of python-couchdb) and dreid (author of paisley), and both of them thinking that it makes sense to merge some of the schema stuff into Paisley, I started to do just that in this branch.

After some plumbing, I was able to re-use my Thing class that was defined against python-couchdb's schema.Document with Paisley. Success!

Three snippets of IRC conversation (that I hope the authors are fine with me sharing):

from private chat:

cmlenz: and if you port, please rename s/schema/mapping or something like that :)
cmlenz: schema was a horrible name choice for what it does
homeasvs: ok, will keep that in mind

from #twisted:

dreid: homeasvs: Thank you for volunteering.
homeasvs: dreid, no problem
homeasvs: dreid, I was discussing with cmlenz who did python-couchdb and he suggested I take some of his document modeling stuff and graft it onto paisley
dreid: homeasvs: No, I mean volunteering to maintain paisley.
homeasvs: dreid, heh :)
homeasvs: dreid, I might be persuaded if this works out
dreid: I'm afraid you don't understand how this works.
dreid: You volunteered.
dreid: If you don't want to do it, you have to fight a bear.
dreid: ;)
homeasvs: I thought the last touched rule only applied to the master branch :)
dreid: That's not what this is.

from #couchdb:

dreid: homeasvs < - FYI this guy has volunteered to maintain paisley.

These are the days I like how open source works. I am ending the day with two more projects than I started it with.

That reminds me, I should apply dreid's approach to one of my projects and figure out how to give someone commit access...


  1. This project management methodology was actually pioneered by Twisted’s own Glyph Lefkowitz.

    “Usually the protocol is this: I appoint someone for a task,
    which they are not qualified to do. Then, they have to fight
    a bear if they don’t want to do it.” — Glyph Lefkowitz

    Comment by David Reid — 2009-12-09 @ 01:23

  2. Excellent! I was using Paisley for a project I was working on, I was waiting for it to grow a few more features like the attachment API and kind of never got the time to go back to it. Twisted really does seem the sensible architecture for this kind of thing.

    Comment by Alan Bell — 2009-12-29 @ 22:50

  3. So, any plans of releasing a new version of Paisley? We’re evaluating couchdb and we’d like to use it with twisted. Thanks!

    Comment by Orestis Markou — 2010-01-14 @ 12:48

  4. Yes, I’d like to release, but I’m currently collecting input from people that use or plan to use it, so that I can see if the recent changes I did make sense and are the way people want it to go.

    So let me know what you think!

    Comment by Thomas — 2010-01-14 @ 22:54

RSS feed for comments on this post. TrackBack URL

Leave a comment