Automatic revision tracking and rollback for ViUR skeletons.
Project description
viur-revision
Automatic revision tracking and rollback for ViUR skeletons.
What it does
viur-revision snapshots the pre-write state of any tracked skeleton into a
companion datastore kind (<kind>_revision) on every write. Each revision
entity carries:
- a verbatim copy of all original entity properties
origin_key— the original entity's keyrevision_index— monotonically increasing counter per originrevision_date— UTC timestamp of the snapshotrevision_change_list— bone names that changed in this write
The package adds endpoints to list, view, restore, and delete revisions, plus a tiered retention task that thins out the history over time.
Requirements
- Python ≥ 3.12
- viur-core ≥ 3.7, < 4
Install
pip install spltz-viur-revision
Usage
1. Make a skeleton track revisions
from viur.revision import RevisionAbstractSkel
class ExampleSkel(RevisionAbstractSkel, Skeleton):
# Track every write (default):
pass
Or only react to changes on specific bones:
class ExampleSkel(RevisionAbstractSkel, Skeleton):
revision_fields = ["title", "body"]
2. Expose revision endpoints on the module
from viur.revision import RevisionModule
class Example(RevisionModule, List):
...
This adds:
GET /<module>/list_revision?key=<entity-key>GET /<module>/view_revision?key=<entity-key>&version=<n|latest>POST /<module>/apply_revision(skey-protected)POST /<module>/delete_revision(skey-protected)GET /<module>/cleanup_revisions_now(manual retention run)
All endpoints require either the root right or <moduleName>-manage.
3. Retention
A daily PeriodicTask thins history per origin_key:
| Age | Retention |
|---|---|
| < 24h | keep all |
| 1d–7d | 1 per hour (latest) |
| 7d–30d | 1 per day (latest) |
| > 30d | 1 per week (latest) |
Documentation
Full reference at sprengplatz.github.io/viur-revision.
Development
git clone https://github.com/sprengplatz/viur-revision
cd viur-revision
pip install -e ".[dev]"
pytest # 100% coverage required
mkdocs serve # docs at http://localhost:8000
License
MIT — see LICENSE.
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 spltz_viur_revision-0.1.0.tar.gz.
File metadata
- Download URL: spltz_viur_revision-0.1.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f48ecde6866d3760028ef39eb63b5ebd83543a7c4a2f8abc1a0969a384a156e
|
|
| MD5 |
e34900fcb457e41300a4beb58f359d38
|
|
| BLAKE2b-256 |
fa74a4ab4ad8e8c8c8ed4c0db1003421572719fc5ffcc40436b95dda5f14dd08
|
Provenance
The following attestation bundles were made for spltz_viur_revision-0.1.0.tar.gz:
Publisher:
release.yml on sprengplatz/viur-revision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spltz_viur_revision-0.1.0.tar.gz -
Subject digest:
9f48ecde6866d3760028ef39eb63b5ebd83543a7c4a2f8abc1a0969a384a156e - Sigstore transparency entry: 2125001181
- Sigstore integration time:
-
Permalink:
sprengplatz/viur-revision@79fcdf3be81ca94f31acec041082f58cd8572e3f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sprengplatz
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@79fcdf3be81ca94f31acec041082f58cd8572e3f -
Trigger Event:
push
-
Statement type:
File details
Details for the file spltz_viur_revision-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spltz_viur_revision-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2309451a513c2b811e2e83eec5b20e3420c2c6f2bcfa9a3d2df085ae2c09ebf3
|
|
| MD5 |
7772332934cc9a3e8f3a09ac81a1fb84
|
|
| BLAKE2b-256 |
dffedd1260434a986001594740549991632c2cbec8e20af1f41cbcc527e36969
|
Provenance
The following attestation bundles were made for spltz_viur_revision-0.1.0-py3-none-any.whl:
Publisher:
release.yml on sprengplatz/viur-revision
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spltz_viur_revision-0.1.0-py3-none-any.whl -
Subject digest:
2309451a513c2b811e2e83eec5b20e3420c2c6f2bcfa9a3d2df085ae2c09ebf3 - Sigstore transparency entry: 2125001255
- Sigstore integration time:
-
Permalink:
sprengplatz/viur-revision@79fcdf3be81ca94f31acec041082f58cd8572e3f -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/sprengplatz
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@79fcdf3be81ca94f31acec041082f58cd8572e3f -
Trigger Event:
push
-
Statement type: