Skip to main content

Hubris

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hubris-0.0.3.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

hubris-0.0.3-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file hubris-0.0.3.tar.gz.

File metadata

  • Download URL: hubris-0.0.3.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for hubris-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e31f88134270b718390a6b8002028787fc5fdd31f0de74ef64611020db3af367
MD5 65f6aa5299b0a061a55f2855c07d9349
BLAKE2b-256 b57fff3dd11123f9c0987c0f46d981c7f3d1f2aec63b269f8f2621d8728d7de0

See more details on using hashes here.

File details

Details for the file hubris-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: hubris-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for hubris-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 78666fa35d372584178cddcb98f4f97ac1452acae4118b07556f7f01c314a7cf
MD5 36ad3a5d8f27819e7bdf077b2ad56746
BLAKE2b-256 10ed9a21a65f0b3b4e889b8da3e5ea725840ecc04cd88dfd6e48a50152fbd1fd

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page