Metadata-Version: 2.4
Name: snap-queue
Version: 1.0.0
Summary: SnapQueue is a lightweight, thread-safe FIFO queue for Python that combines in-memory speed with dur
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: requires-python
Dynamic: summary

# 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

```bash
pip install snap-queue
```

## Usage

```python
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
