Bubus-py310x is a modified fork of the `bubus` event bus library, specifically designed to support Python 3.10 by replacing usages of `asyncio.timeout` (introduced in Python 3.11) with compatible alternatives. It provides a Pydantic-powered, fully-featured event bus for building asynchronous Python applications, supporting type-safe publish-subscribe patterns with async/sync handler support and advanced features like event forwarding and concurrency control. The current version is 1.3.0, and it maintains an active release cadence to ensure Python 3.10 compatibility.
pip install bubus-py310xVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to set up an `EventBus`, define `BaseEvent` models with Pydantic, register asynchronous handlers, and dispatch/expect events. It showcases nested event handling and the use of `bus.expect` with a timeout, which is made compatible with Python 3.10 by this fork.
Use `bubus-py310x` if targeting Python 3.10 to ensure `asyncio.timeout` compatibility.
Ensure your event handlers conform to the specified `BaseEvent` return type or omit the generic parameter if no strict return type is required.
Configure `max_history_size` on your `EventBus` for automatic cleanup, or explicitly call `bus.stop(clear=True)` when an `EventBus` instance is no longer needed.
Ensure you have installed `bubus-py310x` using `pip install bubus-py310x` and your import statements are `from bubus import ...` (the module name remains 'bubus').
Ensure all `async` functions are `await`ed. If using `bubus-py310x` for Python 3.10, this specific `asyncio.timeout` issue is resolved by the fork. If still encountering, verify your handlers and event dispatches are correctly structured for `async`/`await`.
Review the data passed when creating an event instance (e.g., `UserLoginEvent(username='alice', is_admin=True)`) and ensure it matches the fields and types defined in your `BaseEvent` subclass (e.g., `UserLoginEvent`).