Multi-Producer Multi-Consumer Observer Pattern for Python
Project description
PyDispatcher Multi-producer Multi-consumer Observables
PyDispatcher provides the Python programmer with a multiple-producer-multiple-consumer signal-registration and routing infrastructure for use in multiple contexts. The mechanism of PyDispatcher started life as a highly rated recipe in the Python Cookbook. The project aims to include various enhancements to the recipe developed during use in various applications. It is primarily maintained by Mike Fletcher. A derivative of the project provides the Django web framework's "signal" system.
Installation
PyDispatcher is available on PyPI via standard PIP:
pip install PyDispatcher
Usage
Documentation is available for detailed usage, but the basic idea is:
from pydispatch import dispatcher
metaKey = "moo"
MyNode = object()
event = {"sample": "event"}
def callback(event=None):
"""Handle signal being sent"""
print("Signal received", event)
dispatcher.connect(callback, sender=MyNode, signal=metaKey)
dispatcher.send(metaKey, MyNode, event=event)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file PyDispatcher-2.0.6.tar.gz
.
File metadata
- Download URL: PyDispatcher-2.0.6.tar.gz
- Upload date:
- Size: 38.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d7e4f43c70000a1dca31f92694e99d0101934fa6eab5d5455a758858d86df95 |
|
MD5 | 38e9a2b00b2aaf7f1b2d9d8fe8dc4b57 |
|
BLAKE2b-256 | a7999db7d8b5a04596cde1c94e79db26c9a755015abdbdc88dec7e7e506eafbb |