| Build Status | |
| Supported Versions | |
| Latest Version |
gossip is a library implementing a basic hook mechanism for implementing callbacks. It provides flexible configuration, hook namespaces and error handling strategies.
$ pip install gossip
The simplest use case when we want to register a callback to be called later. We start by registering a callback through gossip.register:
>>>from __future__ importprint_function>>>importgossip>>>@gossip.register('hook_name')
... deffunc():
... print('Called')Now we can call the hook:
>>>gossip.trigger('hook_name')
CalledPlain publish/subscribe is just the tip of the iceberg. Gossip is geared towards implementing complex plugin systems, and supports many more advanced features, such as:
- Token (bulk) unregistration of hooks
- Hook dependencies - control the order of hook callbacks, either implicitly or explicitly
- Non-reentrant hooks
- Custom exception handling strategies
And much more. For more information, please refer to the documentation
BSD3