Advisory-only setattr hooks with veto support
Project description
Reaktome
Reaktome is a CPython extension that installs advisory hooks on Python’s built-in containers (list, dict, set).
It allows you to observe and react to mutations without subclassing or replacing types.
Features
- Patch individual instances of built-in containers.
- Hook into mutations (
append,pop,__setitem__, etc.). - Hooks are called after the mutation (advisory only).
- Works per-instance via an internal side-table.
Example
import _reaktome
def on_additem(self, key, old, new):
print(f"{self} added {new}")
lst = []
_reaktome.patch_list(lst, {"__reaktome_additem__": on_additem})
lst.append(42)
# Output: [] added 42
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
reaktome-0.1.10.tar.gz
(19.7 kB
view details)
File details
Details for the file reaktome-0.1.10.tar.gz.
File metadata
- Download URL: reaktome-0.1.10.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ffc8afc5db32541fa907dbbe4f2c7969c1f4974ba3f9e9103ea5f5c6b8640568
|
|
| MD5 |
5baf8d5ec32c468d4a5b8b1492463bcc
|
|
| BLAKE2b-256 |
abf84da3ee72f1b57d202dca1ca55b8329c7966a9cc8e5dd73a905c7282f48a8
|