Skip to main content

Event dispatcher (see python-whistle.readthedocs.io).

Project description

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

PyPI Python Versions 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/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

whistle-2.1.4.tar.gz (161.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

whistle-2.1.4-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file whistle-2.1.4.tar.gz.

File metadata

  • Download URL: whistle-2.1.4.tar.gz
  • Upload date:
  • Size: 161.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for whistle-2.1.4.tar.gz
Algorithm Hash digest
SHA256 15fb4c9d46d32e658472da475697cb2573768a19579f1d139606fe1de5285fee
MD5 60a2f0fde55d30300bf89a98e57e5cee
BLAKE2b-256 22625e2357cb0b02d5323094d0010892295bfe7eb745e5588ee15ddcddee8c72

See more details on using hashes here.

Provenance

The following attestation bundles were made for whistle-2.1.4.tar.gz:

Publisher: release.yml on python-whistle/whistle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file whistle-2.1.4-py3-none-any.whl.

File metadata

  • Download URL: whistle-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for whistle-2.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 fc9ecb230380caa64e52174091de7d16eacd0425bd8967410aa266c87bcd5b6b
MD5 68f3fd8b2772c5b88c0a1f0c97c40124
BLAKE2b-256 c24f66cbfef4a8502ff627f628ffd8c5dbfddb06dcd4fedefd0112c6beb0bbff

See more details on using hashes here.

Provenance

The following attestation bundles were made for whistle-2.1.4-py3-none-any.whl:

Publisher: release.yml on python-whistle/whistle

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page