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
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.
homeasvs: I thought the last touched rule only applied to the master branch :)
dreid: That’s not what this is.
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…