Registry / web-framework / pyventus

pyventus

JSON →
library0.8.0pypypi✓ verified 87d ago

Pyventus is a modern and robust Python library for event-driven and reactive programming. It provides a comprehensive suite of tools to define, emit, manage, and orchestrate events with ease, using customizable event emitters and flexible responses. The current version is 0.8.0. The library is actively maintained with a regular release cadence, ensuring ongoing compatibility and feature enhancements.

pip install pyventus
INSTALL
IMPORT
SIG · PYVENTUS
P
pyventus
web-frameworkpythonv0.8.0
Install
1.6s avg
Import
288ms
Disk
16MB
Pass rate
8/ 10
Env Coverage8 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.8.0 · 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
musl
glibc
py 3.10
✓ —
✓ 1.75s
py 3.11
✓ —
✓ 1.7s
py 3.12
✓ —
✓ 1.53s
py 3.13
✓ —
✓ 1.58s
py 3.9
✕ build_error
✕ build_error
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

EventEmitter
from pyventus.events import EventEmitter
from pyventus import EventEmitter
As of v0.7.0, all event-driven features, including EventEmitter, must be imported from the `pyventus.events` subpackage due to the integration of reactive programming paradigms.
EventLinker
from pyventus.events import EventLinker
from pyventus import EventLinker
Similar to EventEmitter, EventLinker and other event-driven features were moved to the `pyventus.events` subpackage in v0.7.0.
AsyncIOEventEmitter
from pyventus.events import AsyncIOEventEmitter
from pyventus import AsyncIOEventEmitter
This specific EventEmitter implementation, along with other event-driven components, was moved to `pyventus.events` in v0.7.0.

This quickstart demonstrates the basic event-driven usage of Pyventus. It defines an event handler using the `@EventLinker.on` decorator for a 'GreetEvent' and then emits this event using an `AsyncIOEventEmitter` instance. When the event is emitted, the `handle_greet_event` function is called, printing 'Hello, World!'.

from pyventus.events import AsyncIOEventEmitter, EventEmitter, EventLinker # Define an event handler using the EventLinker decorator @EventLinker.on("GreetEvent") def handle_greet_event(): print("Hello, World!") # Create an event emitter instance event_emitter: EventEmitter = AsyncIOEventEmitter() # Emit the custom event, triggering the handler event_emitter.emit("GreetEvent")
Debug
Known issues
breakingBreaking change in v0.7.0: All event-driven features (e.g., `EventEmitter`, `EventLinker`) must now be imported from `pyventus.events` instead of directly from the top-level `pyventus` package.
fix
Update import statements from `from pyventus import ...` to `from pyventus.events import ...`.
affects: >=0.7.0
breakingBreaking change in v0.5.0: The base `Event` class was removed due to improved event semantics and redundancy. Custom event classes no longer need to inherit from a base `Event` class.
fix
Remove inheritance from `Event` for custom event classes. Review and update any code that explicitly referenced `Event` class properties or methods.
affects: >=0.5.0
breakingBreaking change in v0.5.0: Several methods of `EventLinker` were renamed. For example, `get_event_registry()` was renamed to `get_registry()`, and `get_events_by_handler()` was renamed to `get_events_by_event_handler()` (later `get_events_from_subscribers()` in closely related updates).
fix
Review `EventLinker` method calls and update them to use the new names, such as `EventLinker.get_registry()`.
affects: >=0.5.0
breakingBreaking change in v0.3.0: The internal `_execute()` method of `EventEmitter` was renamed to `_process()`. Additionally, all debug flags were renamed from `debug_mode` to `debug` for consistency.
fix
If interacting with `EventEmitter`'s internal processing logic or `debug` flags, update method names and flag names accordingly.
affects: >=0.3.0
gotchaThe `typing-extensions` package became a required dependency from v0.7.0 onwards to support advanced typing features. If you encounter `ModuleNotFoundError` related to `typing_extensions`, it might be missing.
fix
Ensure `typing-extensions` is installed: `pip install typing-extensions`.
affects: >=0.7.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pyventus'
The pyventus library has not been installed in the current Python environment, preventing the Python interpreter from locating the module.
fix
pip install pyventus
ModuleNotFoundError: No module named 'pyventus.core.event_emitter'
Attempting to import internal submodules directly (like pyventus.core or pyventus.emitters) instead of using the public API exposed at the top-level pyventus package.
fix
from pyventus import EventEmitter, Event
AttributeError: 'EventEmitter' object has no attribute 'dispatch'
Attempting to call an event emission method with a name like 'dispatch' or 'fire', which does not exist; pyventus uses the 'emit' method.
fix
event_emitter.emit(MyEvent("Hello"))
TypeError: my_listener() takes 0 positional arguments but 1 was given
An event listener function, decorated with @event_emitter.on(), was defined without any parameters, but pyventus attempts to pass the event object to it.
fix
from pyventus import EventEmitter, Event

event_emitter = EventEmitter()

class MyEvent(Event):
    def __init__(self, data: str):
        self.data = data

@event_emitter.on(MyEvent)
def my_listener(event: MyEvent): # The 'event' parameter is crucial
    print(f"Received event with data: {event.data}")

event_emitter.emit(MyEvent("Hello, Pyventus!"))
Upgrade
Version history
0.8.0latest on PyPI · released Mar 1, 2026
Audit
Dependencies
pythonrequiredRequires Python 3.10 or higher.
typing-extensionsrequiredRequired for advanced typing features, especially for older Python versions (prior to 3.10) where certain typing features were not yet standard. Became a required dependency in v0.7.0.
Agent activity
6 hits · last 30 days
node
4
Resources
pyventus — pip install pyventus · libregistry