skip to navigation
skip to content

Not Logged In

smoke 0.2.0

concise publish/subscribe utility

A concise Publish/Subscribe utility module. It supports both free-form signal names and a stricter style where signals are declared first. You can also mix them.

https://secure.travis-ci.org/keis/smoke.png?branch=master https://coveralls.io/repos/keis/smoke/badge.png?branch=master

Usage

import smoke

class MyCls(smoke.Broker):
    appears = smoke.signal('appears')
    leaves = smoke.signal('leaves')

def say_hello(what):
    print("hello %s" % (what,))

def say_goodbye(what):
    print("good bye %s" % (what,))

# Using broker
o = MyCls()
o.subscribe("appears", say_hello)
o.publish("appears", what='world')

# Using declared signals
o = MyCls()
o.leaves.subscribe(say_goodbye)
o.leaves.publish(what='world')

# Mixing
o = MyCls()
o.subscribe("appears", say_hello)
o.appears.publish()
 
File Type Py Version Uploaded on Size
smoke-0.2.0.tar.gz (md5) Source 2013-12-11 4KB
  • Downloads (All Versions):
  • 12 downloads in the last day
  • 57 downloads in the last week
  • 321 downloads in the last month
  • Author: David Keijser
  • Keywords: publish subscribe pubsub signal
  • License: MIT
  • Package Index Owner: keis
  • DOAP record: smoke-0.2.0.xml