Fast and simple queue workers
Project description
Eventide
Streamlined, no-fuss queue workers for Python.
Overview
Eventide is a streamlined, easy-to-setup framework for building queue workers. It lets you consume messages, schedule messages with cron, handle retries, and manage your worker lifecycle simply and reliably.
Installation
# Base installation
pip install eventide
# Choose a queue provider:
pip install eventide[sqs] # AWS SQS support
pip install eventide[cloudflare] # Cloudflare Queues support
# Optional features:
pip install eventide[cron] # Cron scheduling
pip install eventide[watch] # Dev autoreload
pip install eventide[core] # Installs all optional features (not queue providers)
Quick Start
A minimal Eventide app and handler:
from eventide import Eventide, EventideConfig, Message, SQSQueueConfig
app = Eventide(
config=EventideConfig(
queue=SQSQueueConfig(
region="us-east-1",
url="https://sqs.us-east-1.amazonaws.com/123456789012/my-queue",
buffer_size=10, # internal buffer queue
),
)
)
@app.handler("body.event == 'hello'")
def hello_world(message: Message) -> None:
print("Hello ", message.body.get("content", "World"))
Run:
eventide run -a app:app
# or using autoreload (recommended for development)
eventide run -a app:app --reload
Handlers
Handlers process messages matching JMESPath expressions and can define retry behavior.
Example:
@app.handler(
"body.type == 'email' && body.event == 'send'",
retry_limit=5,
retry_for=[ValueError, TimeoutError],
retry_min_backoff=1.0,
retry_max_backoff=30.0,
)
def send_email(message):
print("Sending email:", message.body)
Scheduled Messages - Cron
You can define functions decorated with @app.cron to schedule the sending of messages.
Each cron function generates and returns the message body that Eventide will automatically enqueue to your configured queue provider at the scheduled time.
Example:
@app.cron("*/5 * * * * *") # every 5 seconds
def send_heartbeat():
return {"type": "heartbeat"}
Run the cron process separately from the worker process:
eventide cron -a app:app
# or using autoreload (recommended for development)
eventide cron -a app:app --reload
Workers and the cron scheduler are independent, allowing you to scale your workers without duplicating scheduled messages.
Lifecycle Hooks
Hooks allow you to react to important lifecycle moments:
@app.on_start
def startup():
print("App is starting")
@app.on_shutdown
def shutdown():
print("App is shutting down")
@app.on_message_failure
def on_failure(message, exc):
print(f"Failed handling {message.id}: {exc}")
Available hooks:
on_starton_shutdownon_message_receivedon_message_successon_message_failure
Queue Providers
Eventide currently has built-in support for:
- AWS SQS
- Cloudflare Queues
More providers will be added over time.
You can also implement custom providers by extending the Queue base class.
License
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
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 eventide-0.0.0a15.tar.gz.
File metadata
- Download URL: eventide-0.0.0a15.tar.gz
- Upload date:
- Size: 72.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5f8ae833966ec0b7ab2001aee9ab86410c0b81763ac04733da14e149a7c321ff
|
|
| MD5 |
77d7030ca44e7942b2747945cd5faa97
|
|
| BLAKE2b-256 |
f55ea6e0350e2cd7c4321e933b233930dcb5a493cdfeaad76c373d855e7b254b
|
File details
Details for the file eventide-0.0.0a15-py3-none-any.whl.
File metadata
- Download URL: eventide-0.0.0a15-py3-none-any.whl
- Upload date:
- Size: 26.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e2b70435fb06f09a51448183c548fe9f43490bc1d759922aabb2def48e8c2bd
|
|
| MD5 |
c2b1e20cbf526084ee1ff511ac05ccc8
|
|
| BLAKE2b-256 |
4dfff25e3fba05a5ee2d2f57c2a8741a663d1db6d1fbef33c83276df4cf4c3a1
|