Skip to content

Repository files navigation

transponder

PyPI Python Versions CI License: MIT

State broadcasting for Python. Keep a state dict and emit snapshots to registered listeners whenever it changes — a minimal observer for live status.

Install

pip install transponder

Quickstart

from transponder import Transponder

seen = []
t = Transponder({"alt": 0})
t.subscribe(lambda s: seen.append(dict(s)))
t.update(alt=1000, squawk="1200")
assert seen[-1]["alt"] == 1000
assert t.state["squawk"] == "1200"

Why this exists

  • Lightweight observer without a framework
  • Thread-safe updates with deep-copied snapshots
  • Subscribe returns an unsubscribe callable

API

Symbol Description
Transponder(initial=None) State holder + broadcaster
subscribe(listener) Register; returns unsubscribe
update(**kwargs) Merge keys; notify if changed
replace(new_state) Replace entire state; notify if changed
state Deep copy of current state

Related packages

Part of the coldbricks micro-library suite (small, typed, zero-dependency helpers):

Package Role
buzzkill Guaranteed shutdown callbacks
aftercare Reverse-order teardown
fluffer Startup pre-warm
edging Token-bucket rate limit
readback Echo-confirmation validation
hearback Output re-validation decorator
agecheck Timezone-correct age thresholds
transponder State broadcast on change

Development

pip install -e ".[dev]"
pytest -q
ruff check .
mypy src

Roadmap

This is an early 0.1.0 release (Alpha) with active development planned:

  • Filtered subscriptions by key
  • Async listeners
  • Wire-format codecs for network broadcast

License

MIT © Coldbricks — coldbricks@gmail.com

About

State broadcasting: emit state dict to listeners on change.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages