A standalone, reusable Django package for long-running operations with a live WebSocket + HTMX user interface — no page reloads, no polling.
pip install django-liveops
# optional extras:
pip install django-liveops[redis] # Redis channel layer (production)
pip install django-liveops[celery] # Celery worker runner
pip install django-liveops[cli] # tqdm progress bar for text modeRequires Python 3.11+ and Django 5.2+. See the Getting Started guide for the full setup (channels, ASGI, settings).
The developer writes one method:
from liveops.models import LiveOperation
from liveops.progress import Progress
class MyImport(LiveOperation):
def run(self, p: Progress):
for row in p.track(rows, label="Processing"):
process(row)
p.log(f"done: {row}")
p.result()The framework handles channels, tokens, OOB-swaps, snapshot-on-connect, throttling, and cooperative cancellation.
A self-contained demo project lives in example/.
# Browser demo — Daphne + Redis + Celery worker, live WebSocket progress.
# Opens http://localhost:8000 (needs Docker).
make demo
# Zero-infra text demo — runs synchronously, prints progress to stdout.
# No Docker, no Redis, no browser.
make demo-textBoth targets also work from inside example/ (cd example && make demo);
the root make just delegates there. See example/README.md
for what you'll see and how the demo is wired.
Full docs are published at
https://iplweb.github.io/django-liveops/ (source in docs/).
MIT — see LICENSE.