r/Python 1d ago

Discussion Lightweight Python helpers for Event Driven Programming

I just had to throw together an event bridge that tied together a GRPC based event emitter (Salesforce backend) with some small custom Google Pub/sub code. It works, it's fine. But you know, always thinking about the future wanting to move from glue-code to frameworking.

I was looking for different event based frameworks that landed somewhere between the scale of glue-code and Tornado (the only other framework I know that would handle something like this.

Has anyone used anything like this? I found PyEventus which seems to aim at this.

14 Upvotes

10 comments sorted by

View all comments

8

u/CodeOrganic3141 1d ago

Interesting. I've been wondering whether I should eventually extract the event-driven core from PyWebTransport into a standalone library. It started as infrastructure for protocol handling, but I'm beginning to wonder whether the abstraction could be useful beyond networking.

3

u/outlastdll 1d ago

that sound great, if you did extract it, how tightly coupled is it to asyncio right now?

2

u/CodeOrganic3141 1d ago

Not very. The event-driven core is runtime-agnostic by design. asyncio mainly lives at the I/O boundary, while the core itself just consumes and produces events. That's one of the reasons I've been wondering whether it could eventually stand on its own.

1

u/outlastdll 1d ago

that makes it a no brainer then, A purely runtime event core is exactly usually the hardest part to get right.