Autosaving dictionary-like file objects
Project description
autosave
Installation
pip install autosave
Example
from autosave import File, AppStorage
# When editing multiple entries,
# use a with statement to only save on exit.
with File('my_file.json') as data:
data['dessert'] = 'pancakes'
data['genre'] = 'jazz'
# By indexing entries on their own, the file is saved on each edit.
# This is adviced against if you're editing multiple entries at a time,
# as it is much less performant.
file = File('my_file.json')
file['garbage'] = 'smooth' + file['genre']
# Get access to the right directories for your app,
# by using this wrapper around `appdirs`
app = AppStorage('MyApp')
app.data / 'plugins/baguette.json'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autosave-1.0.0.post1.tar.gz
(3.0 kB
view hashes)
Built Distribution
Close
Hashes for autosave-1.0.0.post1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2692aba7b9f34cb1ddcd4cad8282888975f9fb53143a8c6dc90a8cf07bc500f3 |
|
MD5 | 1afb2c8bb1bbb3cdcc7cc4a32c58fde8 |
|
BLAKE2b-256 | 905dc8eb7609909364730c3f1c58baeeebbd67063df65d32ae5e0e826fbbb4d6 |