Install & Compatibility
Where this runs
tested against v0.12.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.925 runs
installs and imports cleanly · install 0.0s · import 0.000s · 51.2MB
glibcpy 3.10–3.925 runs
installs and imports cleanly · install 1.9s · import 0.000s · 52MB
50MB installed
● package 50MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
BaseEventHandler
✓ from fastapi_events import BaseEventHandler
✗ from fastapi_events import event_dispatch
event_store
✓ from fastapi_events import event_store
✗ from fastapi_events import event_dispatch
handler_store
✓ from fastapi_events import handler_store
✗ from fastapi_events import event_dispatch
Basic FastAPI app that dispatches a local event and handles it synchronously.
from fastapi import FastAPI
from fastapi_events import event_dispatch
from fastapi_events.middleware import EventHandlerASGIMiddleware
from fastapi_events.handlers.local import LocalHandler
app = FastAPI()
handler = LocalHandler()
app.add_middleware(
EventHandlerASGIMiddleware,
handlers=[handler],
)
@app.get("/")
async def root():
# Dispatch an event that will be handled locally
event_dispatch("my_event", payload={"key": "value"})
return {"message": "Event dispatched"}
@handler.register("my_event")
def handle_my_event(payload: dict):
print(f"Received event with payload: {payload}")
Upgrade
Version history
0.12.2latest on PyPI · released Dec 21, 2024
Audit
Dependencies
fastapirequiredRequired; the library is built on top of FastAPI
pydanticrequiredRequired for event schema definition and validation
boto3optionalRequired for AWS SQS backend
google-cloud-pubsuboptionalRequired for Google Cloud Pub/Sub backend
aio-pikaoptionalRequired for RabbitMQ backend
redisoptionalRequired for Redis backend
opentelemetry-apioptionalRequired for OpenTelemetry integration