Skip to main content

EDRI

EDRI is a Python framework for building event-driven, parallel, and distributed applications. It combines messaging, task execution, and an optional API layer (REST, WebSocket, HTML) into a single coherent system.

Python License PyPI


Why EDRI?

Most Python frameworks solve one problem well:

  • Celery handles background tasks but has no API layer or pub/sub.
  • Kafka streams messages but does not execute tasks.
  • FastAPI builds APIs but lacks task distribution.

EDRI combines all three: message routing, task execution, and API exposure in one framework.


Quick start

pip install edri[uvicorn]
# main.py
from edri import EDRI
from edri.abstract import ManagerBase, request
from edri.dataclass.event import Event
from edri.dataclass.response import Response, response
from edri.api.dataclass.api_event import api
from http import HTTPMethod


@response
class HelloResponse(Response):
    message: str

@api(url="/hello/{name}", method=HTTPMethod.GET)
class Hello(Event):
    name: str
    response: HelloResponse

class HelloManager(ManagerBase):
    @request
    def greet(self, event: Hello) -> None:
        event.response.message = f"Hello, {event.name}!"

if __name__ == "__main__":
    edri = EDRI()
    edri.add_component(HelloManager(edri.router_queue))
    edri.start_api()
    edri.run()
python main.py &
curl -H "Accept: application/json" http://localhost:8080/hello/World

Full getting-started guide: Getting Started


Architecture overview

Events are the universal communication primitive. The Router dispatches them by type to subscribed Managers. Managers can delegate work to Workers (threads or processes), emit new events, or use specialized components like the Scheduler (timed events) and Key-Value Store (shared state). The API layer translates external HTTP/WS requests into events. For distributed deployments, the Switch connects routers across machines via TCP/IP.


Installation

# Core: Router, Managers, Workers, Switch, Scheduler, Store
pip install edri

# HTTP/WebSocket API, with an ASGI server
pip install edri[uvicorn]    # recommended
pip install edri[hypercorn]  # HTTP/3 support
pip install edri[daphne]     # Twisted-based

# API layer without an ASGI server (e.g. behind edri[grpc])
pip install edri[api]

# Command line (edri new, edri completion)
pip install edri[cli]

# Development
pip install edri[dev]

Requirements

  • Python 3.12+
  • POSIX OS (Linux, macOS — macOS has never been tested)

Getting Started

If you're new to EDRI, start here:

  • Getting Started — installation, minimal example, next steps
  • Architecture — component model, process architecture, data flow
  • Testing — unit and integration testing guide

Core Concepts

  • Event — defining events, responses, field types, lifecycle
  • Response — response status, directives, HTTP status mapping
  • Router — dispatching, subscriptions, caching, health checks
  • Manager — event handlers, workers, lifecycle, caching
  • Worker — thread vs process, communication, event_send

API Layer

  • API — REST, WebSocket, HTML, content negotiation
  • API Event — @api(...) decorator, URL patterns, input extraction
  • Content Negotiation — Accept header handling, response wrapping, Vary
  • Download — Path vs SharedMemoryPipe, HTTP Range
  • HTML — Jinja2 templates, {% url %}, static files
  • WebSocket — connection, commands, subscription protocol
  • Validation — inject(...), built-in validators, custom validators
  • Uploads — file upload lifecycle, temporary files, workers, cleanup responsibility
  • Middleware — pipeline, auth patterns, transport-agnostic design
  • Broker — client management, WebSocket subscription trie, middleware execution

Distribution

  • Connector — Router ↔ Switch bridge, demands, resilience
  • Switch — TCP/IP hub, message protocol, connection lifecycle

Specialized Components


Operations


Examples

Example Area Documentation
REST CRUD with validation REST REST CRUD
HTML form Post/Redirect/Get HTML HTML Form
CPU-bound WorkerProcess Worker CPU Bound
Streaming ZIP via SharedMemoryPipe Worker SharedMemoryPipe
Periodic refresh + Store Scheduler Periodic Refresh
WebSocket ticket pattern WebSocket WebSocket Upload
Bearer token authentication Middleware Auth Middleware

Quick comparison with other frameworks

Feature EDRI Celery Kafka FastAPI
Task execution ✅ Built-in ✅ Workers ❌ Messaging only ❌
API layer ✅ REST/WS/HTML ❌ ❌ ✅ REST/WS
Pub/Sub ✅ Static routing ❌ ✅ Dynamic ⚠️ WS only
Middleware ✅ Full pipeline ❌ ❌ ✅ DI
Distributed ✅ Via Switch ✅ Brokers ✅ Clusters ❌
Parallelism ✅ Threads + processes ✅ Workers ⚠️ Consumers ⚠️ Async

License

MIT License.

Author

Marek Olšan (marek@olsanovi.cz)

Metadata

Release files for edri 2026.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for edri 2026.10.4
File Size Uploaded Provenance
edri-2026.10.4.tar.gz 326.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for edri 2026.10.4
File Interpreter ABI Platform
edri-2026.10.4-py3-none-any.whl Python 3 none any Details

Total release size: 708.7 kB

Release files / edri-2026.10.4.tar.gz

Download URL edri-2026.10.4.tar.gz
Size 326.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d8a94c0bea7013a7c1120413e354c94ce64a7fa278628329bb20fe5ea4667183
BLAKE2b-256 checksum
How to use checksums
76064440d1041eef6043a0267f633a93b460c51a5d3ed5cac9fb5e040caab0f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.16

Release files / edri-2026.10.4-py3-none-any.whl

Download URL edri-2026.10.4-py3-none-any.whl
Size 382.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
35b9ea89abc15702102b554b7a711c29ff2acf320eaf07367379cbbbe30ff107
BLAKE2b-256 checksum
How to use checksums
24fc55dfd3075759090c7c2718591ca151e8ab14ee834819e7ac292b051e5df0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.16

Security for edri 2026.10.4

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.

Release history Release notifications | RSS feed

This release

2026.10.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page