coopy is a simple, transparent, non-intrusive persistence library for python language. It’s released under BSD License
It is based on the techniques of system snapshotting and transaction journalling. In the prevalent model, the object data is kept in memory in native object format, rather than being marshalled to an RDBMS or other data storage system. A snapshot of data is regularly saved to disk, and in addition to this, all changes are serialised and a log of transactions is also stored on disk.
Simple, transparent and non-intrusive. Note that Todo could be any class that you want to persist state across method calls that modifies it’s internal state:
from coopy.base import init_persistent_system
class Todo(object):
def __init__(self):
self.tasks = []
def add_task(self, name, description):
task = dict(name=name, description=description)
self.tasks.append(task)
persistent_todo_list = init_persistent_system(Todo())
persistent_todo_list.add_task("Some Task Name", "A Task Description")
Check out how coopy works with this little 1 minute coopy tutorial and then...
It’s very important to know how coopy works, to use it. Check out coopy basics
This should not affect end-user code. To get datetime or date objects you need to get from an internal clock. Check this page How to Use Clock
coopy is compatible with py2.6, py2.7, py3.2, py3.3 and pypy.
coopy code is hosted on github at: http://github.com/felipecruz/coopy
Found a bug? http://github.com/felipecruz/coopy