Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hearback-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hearback-0.1.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

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

Hashes for hearback-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c55dc54eea307270bd2d070ec3740b9102b73a763acee9b71b91ad9442f9a09a
MD5 3928191f51cdb846fede448b2455ea29
BLAKE2b-256 67199d79880786f2db09eee5b4c9e49c22ee73a8cff84ff0c8ca01e8cb1863b8

See more details on using hashes here.

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

Hashes for hearback-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 081cee35ded82a9c4cb0713c020e9494645f0d4d374aa393f0a863def8fa2589
MD5 b2f6317d26c7aa69fadd8498e5168c1a
BLAKE2b-256 9f645d24a87e88aa472e2181e21c536ef073ec636f54ca1650043721b5f55012

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page