| 1 |
Metadata-Version: 2.1 |
| 2 |
Name: PyDispatcher |
| 3 |
Version: 2.0.7 |
| 4 |
Summary: Multi-producer multi-consumer in-memory signal dispatch system |
| 5 |
Home-page: https://github.com/mcfletch/pydispatcher |
| 6 |
Download-URL: https://pypi.org/project/pydispatcher/ |
| 7 |
Author: Patrick K. O'Brien |
| 8 |
Maintainer: Mike C. Fletcher |
| 9 |
Maintainer-email: "Mike C. Fletcher" <[email protected]> |
| 10 |
License: BSD |
| 11 |
Keywords: dispatcher,dispatch,pydispatch,event,signal,sender,receiver,propagate,multi-consumer,multi-producer,saferef,robustapply,apply |
| 12 |
Platform: Any |
| 13 |
Classifier: License :: OSI Approved :: BSD License |
| 14 |
Classifier: Programming Language :: Python |
| 15 |
Classifier: Programming Language :: Python :: 2 |
| 16 |
Classifier: Programming Language :: Python :: 3 |
| 17 |
Classifier: Topic :: Software Development :: Libraries :: Python Modules |
| 18 |
Classifier: Intended Audience :: Developers |
| 19 |
Description-Content-Type: text/markdown |
| 20 |
Provides-Extra: dev |
| 21 |
|
| 22 |
# PyDispatcher Multi-producer Multi-consumer Observables |
| 23 |
|
| 24 |
PyDispatcher provides the Python programmer with a multiple-producer-multiple-consumer signal-registration and |
| 25 |
routing infrastructure for use in multiple contexts. The mechanism |
| 26 |
of PyDispatcher started life as a highly rated [recipe](http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/87056) |
| 27 |
in the [Python Cookbook](http://aspn.activestate.com/ASPN/Python/Cookbook/). The [project](https://github.com/mcfletch/pydispatcher) aims |
| 28 |
to include various enhancements to the recipe developed during use in |
| 29 |
various applications. It is primarily maintained by [Mike Fletcher](http://www.vrplumber.com). A derivative |
| 30 |
of the project provides the Django web framework's "signal" system. |
| 31 |
|
| 32 |
## Installation |
| 33 |
|
| 34 |
PyDispatcher is available on PyPI via standard PIP: |
| 35 |
``` |
| 36 |
pip install PyDispatcher |
| 37 |
``` |
| 38 |
[](https://pypi.python.org/pypi/pydispatcher) |
| 39 |
[](https://pypi.python.org/pypi/pydispatcher) |
| 40 |
|
| 41 |
|
| 42 |
## Usage |
| 43 |
|
| 44 |
[Documentation](https://mcfletch.github.io/pydispatcher/) is available |
| 45 |
for detailed usage, but the basic idea is: |
| 46 |
|
| 47 |
``` |
| 48 |
from pydispatch import dispatcher |
| 49 |
|
| 50 |
metaKey = "moo" |
| 51 |
MyNode = object() |
| 52 |
event = {"sample": "event"} |
| 53 |
|
| 54 |
|
| 55 |
def callback(event=None): |
| 56 |
"""Handle signal being sent""" |
| 57 |
print("Signal received", event) |
| 58 |
|
| 59 |
|
| 60 |
dispatcher.connect(callback, sender=MyNode, signal=metaKey) |
| 61 |
dispatcher.send(metaKey, MyNode, event=event) |
| 62 |
``` |
| 63 |
|