Event Channel
Another library with a pub/sub implementation. You can subscribe functions to a certain topic (aka event). When a message is sent through this event callback functions subscribed will be executed.
from event_channel import EventChannel
mychannel = EventChannel() # You can also import channel, is an instance already created
def callback(x):
x = x + 1
print(x)
mychannel.subscribe("myevent", callback)
mychannel.publish("myevent", 345)
channel.unsubscribe("myevent", callback)
from event_channel.threaded_event_channel import ThreadedEventChannel
mychannel = ThreadedEventChannel(blocking=False) # You can also import non_blocking_channel, is an instance already created
def callback(x):
x = x + 1
print(x)
mychannel.subscribe("myevent", callback)
mychannel.subscribe("myevent", callback2)
threads = mychannel.publish("myevent", 345)
# Wait thread finish
for thread in threads:
thread.join()
from event_channel.threaded_event_channel import ThreadedEventChannel
my_blocking_channel = ThreadedEventChannel() # You can also import channel, is an instance already created
def callback(x):
x = x + 1
print(x)
mychannel.subscribe("myevent", callback)
mychannel.subscribe("myevent", callback2)
threads = mychannel.publish("myevent", 345)
#at this point all threads are finished
Metadata
Release files for event-channel 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| event_channel-0.4.3.tar.gz | 14.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| event_channel-0.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.5 kB
Release files / event_channel-0.4.3.tar.gz
| Download URL | event_channel-0.4.3.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d9e121ec670a31e2595b3c1274f4a1c51540ade4e362120b8418a0aba0290c3c
|
|
BLAKE2b-256 checksum How to use checksums |
26f9afa1e794a0cd5f2ed6d742104fd89bc999f15980b5ec836910144d5368e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|
Release files / event_channel-0.4.3-py3-none-any.whl
| Download URL | event_channel-0.4.3-py3-none-any.whl |
|---|---|
| Size | 15.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3b52381b9affc02e83ce4cd2a16096b747df8ce1c7a84a62bd9f23a959d51d0d
|
|
BLAKE2b-256 checksum How to use checksums |
d11b25a18971f457072cfc3b519ad0a635132b55638e7a193ae2a8de96407ae8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2
|