pyfiq
pyfiq is a minimal Redis-backed FIFO task queue for Python. It lets you decorate functions with @fifo(...), and they'll be queued for execution in
strict order processed by threaded background workers utilizing Redis BLPOP.
It's for I/O-bound tasks like HTTP requests, webhook dispatching, or syncing with third-party APIs--especially when execution order matters, but you don't want the complexity of Celery or external workers.
Unlike:
- Celery, which requires brokers, workers, and doesn't preserve ordering by default
- AWS Lambda, which don't guarantee FIFO unless using with SQS FIFO + extra setup
pyfiq is:
- Embedded: runs inside your application process (no separate worker service)
- Application-scaled & distributed: queues are processed wherever your app runs
- Order-preserving: per-queue FIFO with one active consumer per queue
- Zero-config: no external orchestrators, brokers, or setup required
It's designed to be very simple, and only provide ordered execution of tasks. The code is rudimentary right now, and there's a lot of room for improvement.
Important #1
This library is intended only for I/O-bound tasks. Using it with CPU-bound code is not recommended, as it runs in a background thread and would block execution.
Important #2
This project is in its early stages of development.
Quick start
Installing
$ pip install pyfiq
Bootstrap the worker
This should run once on application startup, typically in your main thread or service entrypoint:
from pyfiq import threaded_worker, RedisQueueBackend
worker = threaded_worker(
backend=RedisQueueBackend("redis://localhost")
)
This starts a background worker thread that consumes tasks from Redis.
Decorate your functions
Decorate the functions you want to be processed asynchronously in a FIFO queue:
import requests
from pyfiq import fifo
@fifo(queue="http-requests1")
def fetch_google():
requests.get("https://google.com")
@fifo(queue="http-requests1")
def fetch_microsoft():
requests.get("https://microsoft.com")
@fifo(queue="http-requests2")
def fetch_github():
requests.get("https://github.com")
Todo
Redis / pyfiq Core Logic
- Graceful shutdown: Ensure background thread stops cleanly (e.g. via signal handlers or context managers)
- Error handling & logging: Catch and log exceptions inside task execution without crashing the worker
- Retry support: Optional retries on failure, ideally with configurable delay or retry queue
- Task deduplication (optional): Prevent duplicate enqueues via Redis keys or hashes
- Task expiration / TTL: Option to discard stale tasks (use Redis TTL or ZSET-based queues if needed)
- Custom serialization support: Allow override of default JSON serializer (e.g., for datetime, Decimal)
- Connection pool support: Reuse Redis connections across queues and workers
- Support for async decorators (optional): Allow @fifo to be used on async def functions (using asyncio.to_thread etc.)
Testing & Reliability
- Unit tests: Cover queue backend, task dispatch, decorator behavior
- Simulate concurrent enqueuers across instances
CI/CD Pipeline
- GitHub Actions
- Run tests on push & PR
- PyPI publishing on version push tag
- Automatic PyPI publish (publish.yml GA):
Metadata
Release files for pyfiq 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfiq-0.1.1.tar.gz | 7.1 kB | Without provenance | Details for pyfiq-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfiq-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyfiq-0.1.1-py3-none-any.whl |
Total release size: 14.3 kB
Release files / pyfiq-0.1.1.tar.gz
| Download URL | pyfiq-0.1.1.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1bed8a414e4d9a3631382b3bfe929f59bb1e3594dec92a249c35ad0e312c9c9
|
|
BLAKE2b-256 checksum How to use checksums |
450b841b4804292ebb982a4d67216c841c0442e63b886eb8795ef5c699eac904
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.10
|
Release files / pyfiq-0.1.1-py3-none-any.whl
| Download URL | pyfiq-0.1.1-py3-none-any.whl |
|---|---|
| Size | 7.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fd52cb376165038dde20ad548caa8fe2c2b32001c61819e64aaa750c3946eebc
|
|
BLAKE2b-256 checksum How to use checksums |
c5ec098fc91eab45b22b6862d2f23556b0c32f80fe646b242bb8e157ef664843
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.10
|
Security for pyfiq 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.