New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

snap-queue

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Malware was recently detected in this package.

Affected versions:

1.0.0

snap-queue

SnapQueue is a lightweight, thread-safe FIFO queue for Python that combines in-memory speed with dur

pipPyPI
Version
1.0.0
Weekly downloads
69
Maintainers
0
Weekly downloads
 
Created

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

FAQs

Related posts