Quickstart¶
Setup¶
Using the command line¶
Create an archive
$ datafs create new_archive
Use the archive
$ echo "initial contents" | datafs update new_archive --string
$ datafs cat new_archive
initial contents
$ echo "new contents" | datafs update new_archive --string
$ datafs cat new_archive
new contents
$ datafs cat new_archive --version 0.0.1
initial contents
See the full command line documentation
Using python¶
>>> import datafs
>>> api = datafs.get_api()
>>> archive = api.get_archive('new_archive')
>>> with archive.open('r') as f:
... print(f.read())
new contents
>>> with archive.open('w+', bumpversion='major') as f:
... f.write(u'first release')
...
>>> archive.get_versions()
['0.0.1', '0.0.2', '1.0']
Use other packages:
>>> import pandas as pd, numpy as np
>>> with archive.open('w+b') as f:
... pd.DataFrame(np.random.random(4,5)).to_csv(f)
>>> with archive.open('w+') as f:
... f.write(u'')
>>> with archive.open('r', version='1.0.1') as f:
... print(pd.read_csv(f))
...
0 1 2 3 4
0 0.064340 0.266545 0.739165 0.892549 0.576971
1 0.586370 0.903017 0.874171 0.046859 0.747309
2 0.349005 0.628717 0.638336 0.670759 0.493050
3 0.323830 0.697789 0.006091 0.629318 0.039715
See the full python api documentation