An open API service indexing awesome lists of open source software.

https://github.com/coldbricks/buzzkill

Haptic/BLE emergency-stop helper: guaranteed shutdown callbacks.
https://github.com/coldbricks/buzzkill

coldbricks context-manager emergency-stop pypi python shutdown signals typed zero-dependency

Last synced: 14 days ago
JSON representation

Haptic/BLE emergency-stop helper: guaranteed shutdown callbacks.

Awesome Lists containing this project

README

          

# buzzkill

[![PyPI](https://img.shields.io/pypi/v/buzzkill.svg)](https://pypi.org/project/buzzkill/)
[![Python Versions](https://img.shields.io/pypi/pyversions/buzzkill.svg)](https://pypi.org/project/buzzkill/)
[![CI](https://github.com/coldbricks/buzzkill/actions/workflows/ci.yml/badge.svg)](https://github.com/coldbricks/buzzkill/actions)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)

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.

## Install

```bash
pip install buzzkill
```

## Quickstart

```python
from 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"]
```

## Why this exists

- 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

## API

| Symbol | Description |
|--------|-------------|
| `EmergencyStop` | Context manager; guarantees shutdown callback |
| `buzzkill(shutdown)` | Factory returning an `EmergencyStop` |
| `EmergencyStop.fire()` | Invoke the callback at most once |

## Related packages

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

| Package | Role |
|---------|------|
| **buzzkill** | Guaranteed shutdown callbacks |
| [`aftercare`](https://github.com/coldbricks/aftercare) | Reverse-order teardown |
| [`fluffer`](https://github.com/coldbricks/fluffer) | Startup pre-warm |
| [`edging`](https://github.com/coldbricks/edging) | Token-bucket rate limit |
| [`readback`](https://github.com/coldbricks/readback) | Echo-confirmation validation |
| [`hearback`](https://github.com/coldbricks/hearback) | Output re-validation decorator |
| [`agecheck`](https://github.com/coldbricks/agecheck) | Timezone-correct age thresholds |
| [`transponder`](https://github.com/coldbricks/transponder) | State broadcast on change |

## Development

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

## Roadmap

This 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

## License

MIT © Coldbricks — coldbricks@gmail.com