- Home Page
- API Documentation
- Pubsub Recipes
Enter search terms or a module, class or function name.
This documentation is in the process of being updated. You may find it more useful to refer to the source code doc strings and the examples in the examples folder of the source distribution.
There are two supported APIs available in pubsub: the “argspec” API, and a legacy API named “version 1” or v1 for short.
The legacy API was developed as part of wxPython, where pubsub originated. This API is available in pubsub to support wxPython applications based on this API. This distinguishing characteristic of this API is that all data to be sent in a message must fit in one parameter and pubsub does not verify whether the data expected by a listener is present in the message. Note that this API is deprecated!! Only use it if you have no choice.
This API is documented only in Legacy (v1) API.
The Argument Specification (“argspec” for short) API was developed for use in larger applications, where the legacy API was found to provide inadequate support for message validation, debugging and topic documentation, all important considerations in larger projects. The distinguishing characteristics of the argspec API is that the message data can be composite and is controlled by pubsub (via implicit or explicit specification)
The above means that an application written in the legacy API will require a small amount of tweaking, mostly because of the different message sending and receiving syntax.
Except where specifically indicated, the API documentation on this site pertains to the argspec API. A separate section, Legacy (v1) API, documents the v1 API of pubsub.
When installing pubsub as a standalone package in your Python “site packages”, the API available by default will be the Argspec API. In this case, the legacy API can be used only by importing pubsub.setupv1 module before the first ‘from pubsub import pub’ statement. This only needs to be done once for an application.
When using the pubsub package that is installed as part of wxPython (‘from wx.lib.pubsub import ...’), the API provided is the legacy API.
The User Manual consists of the following sections.
Pubsub’s public API is provided via its ‘pub’ and ‘utils’ modules. The following part of this API is unlikely to change:
Listener Exception handling:
The following, related to Topic Specification, are likely to evolve: