Skip to main content

concise publish/subscribe utility

Project description

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.

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,))

o = MyCls()

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

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

Project details


Release history Release notifications

History Node

0.2.0

History Node

0.1.1

This version
History Node

0.1.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
smoke-0.1.0.tar.gz (2.6 kB) Copy SHA256 hash SHA256 Source None Dec 22, 2012

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