incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eli Stevens (Gmail)" <wickedg...@gmail.com>
Subject [ANN] couchable 0.0.1b1 (Python object to couchdb document mapper)
Date Fri, 13 Aug 2010 07:20:55 GMT
I'm happy to announce the availability of couchable 0.0.1b1 (don't let
the low revision number fool you; I anticipate this release will
become a positively geriatric 0.1.0 with little significant change ;).

Couchable is an object mapper between Python 2.7 objects and CouchDB.
It tries to provide a "natural" javascript representation of the
original object, in that an object with a "name" attribute will become
a document with a "name" field, etc.  It also attempts to preserve the
python object with high fidelity - sub objects, dictionaries with
tuple keys, sets, etc. are all supported round-trip, though they might
be harder to work with inside of javascript.

An example that only scratches the surface:
>>> import couchable
>>> cdb=couchable.CouchableDb('example')
>>> class SimpleDoc(object):
...     def __init__(self, **kwargs):
...         for key, value in kwargs.items():
...             setattr(self, key, value)
...
>>> a = SimpleDoc(name='AAA')
>>> cdb.store(a)
'main__.SimpleDoc:2a208810-467f-4feb-a5bb-98d0beb1e5e7'

{
   "_id": "main__.SimpleDoc:2a208810-467f-4feb-a5bb-98d0beb1e5e7",
   "_rev": "1-315ed02172dddb449a4ab38e54b8bb85",
   "couchable:": {
       "class": "SimpleDoc",
       "module": "__main__"
   },
   "name": "AAA"
}

Note that only Python 2.7 is supported ATM.  My use cases don't
include 2.6 or lower, but I would be happy to work with someone who
was interested in using couchable on an older version of Python.

API docs, easy_install info, etc:
    http://pypi.python.org/pypi/couchable/

The source for couchable lives at:
    http://github.com/wickedgrey/couchable

Please use the github issue tracker for bugs:
    http://github.com/wickedgrey/couchable/issues

Couchable is built on the Python CouchDB package:
    http://code.google.com/p/couchdb-python/
But has no affiliation with that project.

Feedback of any kind welcome!  :)  In particular, I'd like to know
what needs better examples and/or documentation; it all seems crystal
clear to me...  ;)

Thanks,
Eli

Mime
View raw message