Listener-side output re-validation decorator against schema/predicate.
Project description
hearback
Listener-side counterpart to echo-confirmation: a decorator that re-validates function outputs against a schema or predicate before they leave the call boundary.
Install
pip install hearback
Usage
from hearback import hearback, HearbackError
@hearback(lambda n: isinstance(n, int) and n >= 0)
def absolute_delta(a, b):
return abs(a - b)
assert absolute_delta(3, 10) == 7
@hearback(str)
def label(x):
return x # must be a str
assert label("ok") == "ok"
try:
label(123)
except HearbackError:
pass
Roadmap
This is an early 0.1.0 release with active development planned:
- JSON Schema / pydantic integration
- Async function support
- Structured advisory payloads on failure
Author
Coldbricks — coldbricks@gmail.com
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 hearback-0.1.0.tar.gz.
File metadata
- Download URL: hearback-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c55dc54eea307270bd2d070ec3740b9102b73a763acee9b71b91ad9442f9a09a
|
|
| MD5 |
3928191f51cdb846fede448b2455ea29
|
|
| BLAKE2b-256 |
67199d79880786f2db09eee5b4c9e49c22ee73a8cff84ff0c8ca01e8cb1863b8
|
File details
Details for the file hearback-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hearback-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081cee35ded82a9c4cb0713c020e9494645f0d4d374aa393f0a863def8fa2589
|
|
| MD5 |
b2f6317d26c7aa69fadd8498e5168c1a
|
|
| BLAKE2b-256 |
9f645d24a87e88aa472e2181e21c536ef073ec636f54ca1650043721b5f55012
|