Skip to main content

SnapQueue

A lightweight, persistent FIFO queue for Python with instant snapshots and restore.

SnapQueue keeps your items in memory for speed while persisting every operation to an append-only journal, so your data survives crashes. Capture a point-in-time snapshot at any moment and roll back to it later — perfect for job pipelines, retries, and local development.

Features

  • Pure Python, zero dependencies
  • Persistent FIFO queue backed by an append-only journal
  • O(1) snapshot and restore
  • Thread-safe by default
  • Works as a context manager

Install

pip install snap-queue

Usage

from snapqueue import SnapQueue

with SnapQueue("jobs.snap") as q:
    q.put("send-email", user_id=42)
    q.put("resize-image", path="cat.png")

    job = q.get()            # ("send-email", {"user_id": 42})

    q.snapshot()             # capture current state

    # ... process more items ...

    q.restore()              # roll back to the snapshot

Snapshot API

  • q.snapshot() — capture the current queue state
  • q.restore() — roll back to the last snapshot
  • q.stats() — length, journal size, and last snapshot time

Snapshots are written atomically, so a crash mid-snapshot never corrupts your journal.

Why SnapQueue?

Unlike heavyweight brokers, SnapQueue needs no server, no config, and no dependencies. Drop it into scripts, tests, or small services where you want durable queues and cheap rollbacks.

License

MIT

Release files for snap-queue 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for snap-queue 1.0.0
File Size Uploaded
snap_queue-1.0.0.tar.gz 4.1 kB Details

Release files / snap_queue-1.0.0.tar.gz

Download URL snap_queue-1.0.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
28e86fd26e0b5965b4afb2d6efc0550a61522418d410f1d85577ef24b1e9fc05
BLAKE2b-256 checksum
How to use checksums
ac54369ccfa1c796764948293044590d8869075c4682cd34317937c2c728d90c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page