Sunday, September 21, 2014

Announcing Morris 1.0

Earlier today I've released the first standalone version of Morris (source, documentation). Morris is named after Gabriel Morris, the inventor of Colonne Morris aka the advertisement column. Morris is a simple and proven Python event/signaling library (not for watching sockets or for doing IO but for generic, in-process broadcast messages).

Morris is the first part of the Plainbox project that I've released as a standalone, small library. We've been using that code for two years now. Morris is simple, well-defined and I'd dare to say, complete. Hence the 1.0 version, unlike the traditional 0.1 that many free software projects start with.

Morris works on python 2.7+ , pypy and python 3.2+. It comes with tests, examples and extensive docstrings. Currently you can install it from pypi but a Debian package is in the works and should be ready for review later today.

Here's a simple example on how to use the library in practice:

from __future__ import print_function

from morris import signal

class Processor(object):
    def process(self, thing):
        self.on_processing(thing)

    @signal
    def on_processing(self, thing):
        pass

def on_processing(thing):
    print("Processing {}".format(thing))

proc = Processor()
proc.on_processing.connect(on_processing)
proc.process("foo")
proc.process("bar")


For more information check out morris.readthedocs.org

No comments:

Post a Comment