Skip to main content

The Python interface to the Hermes message broker.

Project description

pyhermes

Version Badge Build Status

The Python interface to the Hermes message broker.

Documentation

The full documentation is at https://pyhermes.readthedocs.org.

Installation

To install pyhermes, simply:

pip install pyhermes

Then use it in a project:

import pyhermes

Features

  • TODO

Quickstart

Subscriber

To create handler for particular subscription topic decorate your function using subscribe decorator:

import pyhermes

@pyhermes.subscriber(topic='pl.allegro.pyhermes.sample-topic')
def handler(data):
    # process data

This function will be called every time there is new message published to the selected topic.

Publisher

Use publish function to publish data to some topic in hermes:

import pyhermes

@pyhermes.publisher(topic='pl.allegro.pyhermes.sample-topic')
def my_complex_function(a, b, c):
    result = a + b + c
    publish(my_complex_function._topic, {'complex_result': result})

You could publish directly result of the function as well:

import pyhermes

@pyhermes.publisher(topic='pl.allegro.pyhermes.sample-topic', auto_publish_result=True)
def my_complex_function(a, b, c):
    return {'complex_result': a + b + c}

Result of decorated function is automatically published to selected topic in hermes.

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ pip install -r requirements/test.txt
(myenv) $ python runtests.py

Credits

Tools used in rendering this package:

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

pyhermes-0.7.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyhermes-0.7.1-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file pyhermes-0.7.1.tar.gz.

File metadata

  • Download URL: pyhermes-0.7.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for pyhermes-0.7.1.tar.gz
Algorithm Hash digest
SHA256 9a1ac14cde58424e87feb9822bb29717bbaaf7c7c745c282f28629f6614733c7
MD5 c877bcd604b36407a4bd5c3bb72ec10e
BLAKE2b-256 185aa0a18faf03818a9f4c18660ec3e18013c4baa542b13fb2822b94c6f230d9

See more details on using hashes here.

File details

Details for the file pyhermes-0.7.1-py3-none-any.whl.

File metadata

  • Download URL: pyhermes-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 14.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.13

File hashes

Hashes for pyhermes-0.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6ec1b15ac166f1f0a8835e8a3660c84800838e6ae7e21d79d5cb7c8c776a6f5
MD5 e24ad6a80b3068c70ede6a6838d70af8
BLAKE2b-256 1c41a4bd3a33dbeb19e966901632467b2de2bc42e3a9e6fe3e87ae5b735003c4

See more details on using hashes here.

Supported by

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