README.md
1[![Build Status](https://travis-ci.org/jek/blinker.svg?branch=master)](https://travis-ci.org/jek/blinker)
2
3
4# Blinker
5
6Blinker provides a fast dispatching system that allows any number of
7interested parties to subscribe to events, or "signals".
8
9Signal receivers can subscribe to specific senders or receive signals
10sent by any sender.
11
12 >>> from blinker import signal
13 >>> started = signal('round-started')
14 >>> def each(round):
15 ... print "Round %s!" % round
16 ...
17 >>> started.connect(each)
18
19 >>> def round_two(round):
20 ... print "This is round two."
21 ...
22 >>> started.connect(round_two, sender=2)
23
24 >>> for round in range(1, 4):
25 ... started.send(round)
26 ...
27 Round 1!
28 Round 2!
29 This is round two.
30 Round 3!
31
32See the [Blinker documentation](https://pythonhosted.org/blinker/) for more information.
33
34## Requirements
35
36Blinker requires Python 2.4 or higher, Python 3.0 or higher, or Jython 2.5 or higher.
37
38## Changelog Summary
39
401.3 (July 3, 2013)
41
42 - The global signal stash behind blinker.signal() is now backed by a
43 regular name-to-Signal dictionary. Previously, weak references were
44 held in the mapping and ephemeral usage in code like
45 ``signal('foo').connect(...)`` could have surprising program behavior
46 depending on import order of modules.
47 - blinker.Namespace is now built on a regular dict. Use
48 blinker.WeakNamespace for the older, weak-referencing behavior.
49 - Signal.connect('text-sender') uses an alternate hashing strategy to
50 avoid sharp edges in text identity.
51
521.2 (October 26, 2011)
53
54 - Added Signal.receiver_connected and Signal.receiver_disconnected
55 per-Signal signals.
56 - Deprecated the global 'receiver_connected' signal.
57 - Verified Python 3.2 support (no changes needed!)
58
591.1 (July 21, 2010)
60
61 - Added ``@signal.connect_via(sender)`` decorator
62 - Added ``signal.connected_to`` shorthand name for the
63 ``temporarily_connected_to`` context manager.
64
651.0 (March 28, 2010)
66
67 - Python 3.x compatibility
68
690.9 (February 26, 2010)
70
71 - Sphinx docs, project website
72 - Added ``with a_signal.temporarily_connected_to(receiver): ...`` support
73