A lightweight, pure-Python event dispatcher for building decoupled applications.
Key Features:
- 🚀 Pure Python - No external dependencies
- 🔄 Sync & Async - Full support for both synchronous and asynchronous workflows
- 🎯 Type Safe - Prevents mixing sync and async listeners
- 📦 Lightweight - Minimal footprint, maximum flexibility
- 🎛️ Priority Control - Order listener execution
- ⚡ Event Propagation - Stop event flow when needed
pip install whistleRequires Python 3.10 or later. No dependencies.
Create an event dispatcher:
from whistle import EventDispatcher
dispatcher = EventDispatcher()Add a listener to react to events
def on_spectacle_starts(event):
print('Please turn down your phones!')
dispatcher.add_listener('spectacle.starts', on_spectacle_starts)</code></pre>Dispatch!
dispatcher.dispatch('spectacle.starts')For complete documentation, visit https://python-whistle.readthedocs.io/
- Homepage: https://python-whistle.github.io/
- Documentation: https://python-whistle.readthedocs.io/
- PyPI: https://pypi.org/project/whistle/
- Source Code: https://github.com/python-whistle/whistle
- Issue Tracker: https://github.com/python-whistle/whistle/issues
Made with ♥ by Romain Dorgueil and contributors.