Skip to main content
Help us improve Python packaging – donate today!

Python module implementing the observer pattern using a centralized registry

Project Description

Neo-Observer is a Python module implementing the observer pattern using a centralized registry. You send an event to the registry and it will dispatch the call the registered observers of the event. You can register functions or subclasses of a defined observable interface. Events have a name, a sender and optional info object. You can register an observable to receive an event based on its name, sender or both. Require Python 2.5 and higher (excluding Python 3).

2015-06-05: 1.0.1 Dib push the doc on Github. No more wiki and wiki project. Updated REAME.

2011-04-19: To remove any ambiguity, adding the same observer again cancel the previous registration.

2011-04-19: New improved version

  • Use weak references whenever it is possible. Objects no longer referenced by your code will not receive events so you don’t have to remember to call ‘remove_observer’.
  • Any callable can be used as an observer as long as the callable can be called with the single event argument or without argument at all.
  • When adding an observer, you can specify the method to be called on the observer to receive the event.
  • Implementation changes: Using a type hierarchy instead of a type flag for the different types of observers.

While I was having a centralized registry in mind when I was creating this class, I realize that ObserverRegistry can work in a decentralized way too. Any class derived from ObserverRegistry is an ObserverRegistry too (just don’t forget to call init).

Author: Pierre Thibault (pierre.thibault1 -at- gmail.com)

License: MIT

Project site: https://github.com/Pierre-Thibault/neo-observer

Epydoc documentation: https://pierre-thibault.github.io/neo-observer/

Join the user group: http://groups.google.com/group/neo-users

Release history Release notifications

This version
History Node

1.0.1

History Node

1.0.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
neo_observer-1.0.1-py2-none-any.whl (6.8 kB) Copy SHA256 hash SHA256 Wheel py2 Jun 6, 2015
neo-observer-1.0.1.tar.gz (6.2 kB) Copy SHA256 hash SHA256 Source None Jun 6, 2015

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page