Skip to main content

Python Publish-Subscribe Module

Project description

Pypubsub provides a simple way for your Python application to decouple
its components: parts of your application can publish messages (with
or without data) and other parts can subscribe/receive them. This
allows message "senders" and message "listeners" to be unaware of
each other:
* one doesn't need to import the other
* a sender doesn't need to know
* "who" gets the messages,
* what the listeners will do with the data,
* or even if any listener will get the message data.
* similarly, listeners don't need to worry about where messages come from.

This is a great tool for implementing a Model-View-Controller
architecture or any similar architecture that promotes decoupling
of its components.

Note:

This pubsub package was taken from wxPython and improved so that there
is absolutely no dependency on wxPython or any third party libraries, it
is completely self-contained. It is now in its third generation:

* pubsub verion "1": version that was in wxPython (in wx.lib). This
version can still be used from pubsub as a drop-in replacement
for wx.lib.pubsub (2.6 - 2.8.x). This version is
very adequate for small applications with few topic types. Bugs
may be fixed, but no new features will be added.
* pubsub version "2": a re-write of version 1 to support a different,
"experimental" style of topic tree based on classes.
This didn't provide the expected benefits, such as the
ability to use tools like pychecker to check validity of topics.
This version is now deprecated.
* pubsub version "3": more rigorous handling of topics and message data,
making debugging pubsub-based applications easier (especially critical for
large applications with many topics). This is nearing beta very fast.
We're still working on user docs, though "normal" use is quite well
documented, and example of use can be found in the docs
folder in source distribution.

Which version to use in your application can be changed from default (3)
via the pubsubconf module installed along pubsub.

See the Pypubsub website (http://pubsub.wiki.sourceforge.net/) for
further details. Download area is at http://downloads.sourceforge.net/pubsub.

Notes:

* The next release of wxPython should contain PyPubSub. The default will
likely be for it to use version 1.
* This project is hosted on SourceForge as pubsub (www.sf.net/projects/pubsub).
It should not be confused with the PyPubSub (www.sf.net/projects/pypubsub)
project also hosted there, providing a form of network-based publish-subscribe.
The author of the latter was not aware of our pre-existing PyPubSub on
Cheeseshop when they created it, and has only recently agreed to change
their project name, but that hasn't happened yet.

Project details


Supported by

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