Guaranteed emergency-stop helper for Python. Wrap critical sections so a user-supplied shutdown callback always runs — on normal exit, on exception, or on SIGINT.
pip install buzzkillfrom buzzkill import EmergencyStop
stopped = []
def cut_power():
stopped.append("power_cut")
with EmergencyStop(cut_power):
# work that must never leave hardware/live state dangling
pass
assert stopped == ["power_cut"]- Hardware and live sessions must never leave power/state dangling after Ctrl-C
- One callback, fired at most once, even if nested or re-entered
- Works as a context manager or via the
buzzkill()factory
| Symbol | Description |
|---|---|
EmergencyStop |
Context manager; guarantees shutdown callback |
buzzkill(shutdown) |
Factory returning an EmergencyStop |
EmergencyStop.fire() |
Invoke the callback at most once |
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 |
pip install -e ".[dev]"
pytest -q
ruff check .
mypy srcThis is an early 0.1.0 release (Alpha) with active development planned:
- BLE device registry for pairing emergency-stop hardware
- Haptic / status feedback hooks
- Cross-platform signal coverage refinements
MIT © Coldbricks — coldbricks@gmail.com