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
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
persisted-1.0.0b2.tar.gz
(5.0 kB
view hashes)
Built Distribution
Close
Hashes for persisted-1.0.0b2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 228f43735c4b6f32f16c1a4ebb81e29641588b69963ff880243c291b0f000adb |
|
MD5 | f5825f46ebd6e0b266d89e519c538761 |
|
BLAKE2b-256 | c9f6768ae6880e2f4ca802dcc7495cc9d07f66e4c62423847165f970771b776b |