A python package implementing a filesystem based store of JSON datastructures, where older versions are never deleted.
When developing a python-based application or command line tool, you can use this file store to store your data.
Iterating on the solution or creating composite solutions made of multiple tools can then be done with the confidence you will not lose any data.
- Python applications
- Data can be serialized as JSON
- Mostly reads, few writes
import os
from jsonlog import DataStore, DataStoreFS
root_dir = "<somewhere on your filesystem>"
os.makedirs(root_dir)
ds = DataStore(DataStoreFS(root_dir))
# put first version in the store
os.makedirs(os.path.join(root_dir, 'my-item'))
ds.put('item', 'my-item', dict(version=0))
# read and update the item
item = ds.get('my-item')
item['info'] = 'Hello, World'
ds.put('item', 'my-item', item)
Then you should be able to see in <root_dir>/my-item/:
item-1.json item-2.json
Here are the steps to follow to get a working development environment:
Create a virtual environment and activate it
$ virtualenv venv $ . venv/bin/activate
Install development dependencies
$ pip install -r requirements.txt dev_requirements.txt
With the virtual environment active, test your changes before submitting:
$ nosetests -s tests
see LICENSE