Skip to main content

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


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)

Uploaded Source

Built Distribution

autosave-1.0.0.post1-py3-none-any.whl (3.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page