A modular, extensible Python queue service
Project description
Tiny Queue
A modular, extensible Python queue service with support for FIFO, priority, async, and persistent queues. Designed for production use in enterprise applications with monitoring, decorators, and retry logic.
🚀 Features
- ✅ FIFO, Priority, Async, and Persistent Queues
- 🔒 Thread-safe and async-compatible
- 💾 File-based persistence
- 📊 Monitoring hooks (logging, metrics)
- 🔁 Retry and rate-limiting utilities
- 🧩 Decorators for queuing function calls
- 🧪 Easy to test and extend
📦 Installation
pip install tiny-queue
Or clone the repo for local development:
git clone https://github.com/js-sravan/tiny-queue.git
cd queue-service
pip install -e .
Usage
FIFO Queue
from queue_service import FIFOQueue
q = FIFOQueue()
q.enqueue("task1")
print(q.dequeue()) # → "task1"
Priority Queue
from queue_service import PriorityQueue
pq = PriorityQueue()
pq.enqueue("urgent", priority=1)
pq.enqueue("low", priority=5)
print(pq.dequeue()) # → "urgent"
Async Queue
import asyncio
from queue_service import AsyncQueue
async def main():
aq = AsyncQueue()
await aq.enqueue("async-task")
task = await aq.dequeue()
print(task)
asyncio.run(main())
Persistent Queue
from queue_service import PersistentQueue
pq = PersistentQueue(filepath="my_queue.json")
pq.enqueue("saved-task")
print(pq.dequeue())
Additional Utilities
Retry Decorator
from queue_service import retry
@retry(times=3, delay=2)
def fragile_task():
# May fail intermittently
pass
Rate Limiting
from queue_service import rate_limit
@rate_limit(calls_per_second=5)
def api_call():
pass
Queueing Functions
from queue_service import FIFOQueue, queue_task
q = FIFOQueue()
@queue_task(q)
def process_data(x):
return x * 2
process_data(10) # Enqueued as a task
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tiny_queue-0.1.0.tar.gz
(5.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tiny_queue-0.1.0.tar.gz.
File metadata
- Download URL: tiny_queue-0.1.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5c71d21aa6c91194ca4ce25f581c61bd3c1b466ce03f8d33111df04249f68a5
|
|
| MD5 |
7c65664d30dcd314e4e6e77689eb95f3
|
|
| BLAKE2b-256 |
9a9212370c8374b32bce8bb1ba69bf86075e865f0aac973fd2fd8325be64e97d
|
File details
Details for the file tiny_queue-0.1.0-py3-none-any.whl.
File metadata
- Download URL: tiny_queue-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef2f5d55ac66edcb8d45bb4f4a281cef3d04953f1dcba39556e5f9a1450e1454
|
|
| MD5 |
563c412c9272742e03b4029d642301f8
|
|
| BLAKE2b-256 |
cfbb0752ef7464a82613285eb5dc2d39263f7f10672b1b6d45971f8d0bef73bf
|