Skip to main content

A two-way data persistence framework for watching file changes / updating files based on changes

Project description

Persisted

Persisted is a two-way code/data persistence framework. It can update a variable when a watched file changes, and also save data back to the file when the variable changes.

>>> import persisted
>>> data = persisted.as_string('README.md', '')
>>> data.get()
"# Persisted\n\nPersisted is a two-way..."
>>> with data:
        data.value = "Change to this"
>>> data.get()
"Change to this"

This is very useful to keep configuration files / application state synchronized within a long-running application, and also hot-reload code / modules.

Installing

$ python -m pip install persisted

Usage

There are several helper functions for you to get started:

  • persisted.as_bytes
  • persisted.as_string
  • persisted.as_pickle
  • persisted.as_module (only reloading)

All of them call persisted.Persisted to create a Persisted object to interact with.

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

persisted-1.0.0b2.tar.gz (5.0 kB view hashes)

Uploaded Source

Built Distribution

persisted-1.0.0b2-py3-none-any.whl (6.1 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