Hubris
Hubris is a simple library for implementing inter-process communication (IPC)
between separate Python processes. It's based on named pipes created by the
POSIX mkfifo system call.
Hubris uses the "channel" metaphor. You can send and receive data on a with simple send and receive commands. Alternatively, you can have multiple processes subscribe to the a single channel on which data is published asynchronously or at a regular interval.
Sending Data
hub = Hub()
channel = hub['example']
# send data (which is serialized internally)
channel.send({'foo': 'bar'})
hub.close()
Receiving Data
Receiving data can be done synchronously or asynchronously.
hub = Hub()
channel = hub['example']
# block until we receive the data
data = channel.receive()
# ...or immediately return a future object
future = channel.receive(wait=False)
data = future.result(timeout=1)
hub.close()
Publishing Data
Data can be published at a regular interval.
hub = Hub()
channel = hub['example']
# send data (which is serialized internally)
channel.publish({'foo': 'bar'}, interval=timedelta(seconds=1))
# ...or generate data with a callback
channel.publish(generate, interval=timedelta(seconds=1))
# ...or just send data as normally to have it published to subscribers
channel.send({'foo': 'bar'})
hub.close()
Subscribing to Channels
You can subscribe a callback to receive and respond to data published on a channel.
hub = Hub()
channel = hub['example']
# subscribe this thread to the channel, triggering
# callback upon receipt of data
channel.subscribe(lambda: subscription, data: print(data))
hub.close()
Metadata
Release files for hubris 0.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hubris-0.0.4.tar.gz | 8.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hubris-0.0.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.0 kB
Release files / hubris-0.0.4.tar.gz
| Download URL | hubris-0.0.4.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
deed125563574d5b2953a07321f403915a0631b01eb3ed3116fe46402bf1d2b4
|
|
BLAKE2b-256 checksum How to use checksums |
f495002db22003227369de87160b00d287d0993a86c44f2ee3ac8c7df94d3abc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.4
|
Release files / hubris-0.0.4-py3-none-any.whl
| Download URL | hubris-0.0.4-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b3a0ae61d32700c52c3b7fb32e058edb0bc992b9d84cc5e57ced9a3accd6bdef
|
|
BLAKE2b-256 checksum How to use checksums |
a1d8619ea9542e1119a6cdaa3a8ad91ddbf3428be5b9212574422582d749c5ad
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.4
|