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_bytespersisted.as_stringpersisted.as_picklepersisted.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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file persisted-1.0.0b2.tar.gz.
File metadata
- Download URL: persisted-1.0.0b2.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fff963a6ee368602e46b3bcf00933bddc324878bc64d822be1164356a55317e
|
|
| MD5 |
a9f561a9c25844fa3b6c74428cf34133
|
|
| BLAKE2b-256 |
4e63d0b55e591d7e0b139dc8103c6f8c50350d7e4aaf82f235d6f29c5d77daee
|
File details
Details for the file persisted-1.0.0b2-py3-none-any.whl.
File metadata
- Download URL: persisted-1.0.0b2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.10.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
228f43735c4b6f32f16c1a4ebb81e29641588b69963ff880243c291b0f000adb
|
|
| MD5 |
f5825f46ebd6e0b266d89e519c538761
|
|
| BLAKE2b-256 |
c9f6768ae6880e2f4ca802dcc7495cc9d07f66e4c62423847165f970771b776b
|