Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

python-whistle/whistle

Repository files navigation

Whistle

A lightweight, pure-Python event dispatcher for building decoupled applications.

PyPI CI Status License

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

Installation

pip install whistle

Requires Python 3.10 or later. No dependencies.

Quick Start

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')

Documentation

For complete documentation, visit https://python-whistle.readthedocs.io/

Links


Made with β™₯ by Romain Dorgueil and contributors.

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /