Binomic#
A lightweight, customizable asynchronous task framework for Python, built on AnyIO and Redis Streams.
Binomic takes tasks declared with decorators, delivers messages through Redis Streams, executes them in multiprocessing workers, and supervises the whole fleet with an in-process master supervision loop. Message payloads are JSON-serialized with msgspec and task IDs are UUIDv7.
Features#
Declarative tasks: the
@task()decorator withdirect(immediate),cron(cron expression), andinterval(fixed interval) modes; see Task modes and schedulingRedis Streams broker: reliable delivery based on consumer groups and the PEL, with
xautoclaimreclaiming messages from lost consumersRetries and dead-letter queue: failed messages are redelivered after a backoff, up to
max_attempts(3 by default); timed-out, stale and exhausted messages land in the DLQ – see ReliabilityMultiprocessing workers: the master spawns worker subprocesses and keeps supervising them with presence heartbeats – carried over inter-process IPC rather than Redis, so beyond
is_alive()it also sees a process that is up but has stopped beatingType safe: fully checked with mypy strict and ruff; the task registry is built on the generic
TaskSpec[P, T]Observability (optional): unified structlog logging, plus optional traces and metrics through
binomic[otel]– cross-process correlated spans and metrics such as execution duration, delivery lag and queue depth; see ObservabilityLitestar integration: a built-in
BinomicPlugininjects the Binomic client into Litestar dependencies
Requires Python ≥ 3.12 and Redis ≥ 7.x.