Python bindings for Snips Hermes Protocol
Project description
# Hermes Python
[![Build Status](https://travis-ci.org/snipsco/hermes-protocol.svg)](https://travis-ci.org/snipsco/hermes-protocol)
[![PyPI version](https://badge.fury.io/py/hermes-python.svg)](https://badge.fury.io/py/hermes-python)
The `hermes-python` library provides python bindings for the Hermes protocol that snips components use to communicate together.
`hermes-python` allows you to interface seamlessly with the Snips platform and quick start development of Voice applications.
`hermes-python` abstracts away the connection to the MQTT bus and the parsing of incoming and outcoming messages from and to the components of the snips platform.
## Installation
The library is packaged as a pre-compiled platform wheel, available on [PyPi](https://pypi.org/project/hermes-python/).
It can be installed with :
```
pip install hermes-python
```
Or you can add it to your `requirements.txt` file.
### Requirements
The wheel is available for Python 2.7+ and Python 3.5
The wheel supports the following platform tags :
- `manylinux1_x86_64`
- `armv7l`, `armv6`
- `macos`
## Usage
The lifecycle of a script using `hermes-python` has the following steps :
- Initiating a connection to the MQTT broker
- Registering callback functions to handle incoming intent parsed by the snips platform
- Listening to incoming intents
- Closing the connection
Let's quickly dive into an example : Let's write an app for a Weather Assistant !
This code implies that you created a weather assistant using the [snips Console](https://console.snips.ai), and that it has a *`searchWeatherForecast`* intent.
Here is a code example for `python2.7` :
```
from hermes_python.hermes import Hermes
MQTT_ADDR = "localhost:1883" # Specify host and port for the MQTT broker
def subscribe_weather_forecast_callback(hermes, intentMessage): # Defining callback functions to handle an intent that asks for the weather.
print("Parsed intent : {}".format(intentMessage.intent.intent_name))
with Hermes(MQTT_ADDR) as h: # Initialization of a connection to the MQTT broker
h.subscribe_intent("searchWeatherForecast", subscribe_weather_forecast_callback) \ # Registering callback functions to handle the searchWeatherForecast intent
.start()
# We get out of the with block, which closes and releases the connection.
```
### Examples
#### Handling the `intent_message` object
*Coming soon.*
#### Providing TTS feedback for a voice application
*Coming soon.*
## Documentation
### Hermes protocol documentation
If you want to dive deeper into how Snips components communicate together, check out the specification of the `hermes-protocol` [here](https://docs.snips.ai/ressources/hermes-protocol).
You can also check this repository for other language bindings.
### API
*Coming soon.*
## Release Checklist
Everytime you need to perform a release, do the following steps :
- [ ] Commit all changes to the project for said release
- [ ] Write all the changes introduced in the Changelog (HISTORY.rst file) and commit it
- [ ] Run tests
- [ ] Bump the version and commit it
- [ ] Upload to PyPI
## History
### 0.1.27 (2019-01-07)
* Fixed broken API introduced in `0.1.26` with the publish_continue_session method of the Hermes class.
* Cast any string that goes in the mqtt_server_adress parameter in the constructor of the Hermes class to be a 8-bit string.
### 0.1.26 (2019-01-02)
* LICENSING : This wheel now has the same licenses as the parent project : APACHE-MIT.
* Subscription to not recognized intent messages is added to the API. You can now write your own callbacks to handle unrecognized intents.
* Adds send_intent_not_recognized flag to continue session : indicate whether the dialogue manager should handle non recognized intents by itself or sent them as an `IntentNotRecognizedMessage` for the client to handle.
### 0.1.25 (2018-12-13)
* Better error handling : Errors from wrapped C library throw a LibException with detailled errors.
[![Build Status](https://travis-ci.org/snipsco/hermes-protocol.svg)](https://travis-ci.org/snipsco/hermes-protocol)
[![PyPI version](https://badge.fury.io/py/hermes-python.svg)](https://badge.fury.io/py/hermes-python)
The `hermes-python` library provides python bindings for the Hermes protocol that snips components use to communicate together.
`hermes-python` allows you to interface seamlessly with the Snips platform and quick start development of Voice applications.
`hermes-python` abstracts away the connection to the MQTT bus and the parsing of incoming and outcoming messages from and to the components of the snips platform.
## Installation
The library is packaged as a pre-compiled platform wheel, available on [PyPi](https://pypi.org/project/hermes-python/).
It can be installed with :
```
pip install hermes-python
```
Or you can add it to your `requirements.txt` file.
### Requirements
The wheel is available for Python 2.7+ and Python 3.5
The wheel supports the following platform tags :
- `manylinux1_x86_64`
- `armv7l`, `armv6`
- `macos`
## Usage
The lifecycle of a script using `hermes-python` has the following steps :
- Initiating a connection to the MQTT broker
- Registering callback functions to handle incoming intent parsed by the snips platform
- Listening to incoming intents
- Closing the connection
Let's quickly dive into an example : Let's write an app for a Weather Assistant !
This code implies that you created a weather assistant using the [snips Console](https://console.snips.ai), and that it has a *`searchWeatherForecast`* intent.
Here is a code example for `python2.7` :
```
from hermes_python.hermes import Hermes
MQTT_ADDR = "localhost:1883" # Specify host and port for the MQTT broker
def subscribe_weather_forecast_callback(hermes, intentMessage): # Defining callback functions to handle an intent that asks for the weather.
print("Parsed intent : {}".format(intentMessage.intent.intent_name))
with Hermes(MQTT_ADDR) as h: # Initialization of a connection to the MQTT broker
h.subscribe_intent("searchWeatherForecast", subscribe_weather_forecast_callback) \ # Registering callback functions to handle the searchWeatherForecast intent
.start()
# We get out of the with block, which closes and releases the connection.
```
### Examples
#### Handling the `intent_message` object
*Coming soon.*
#### Providing TTS feedback for a voice application
*Coming soon.*
## Documentation
### Hermes protocol documentation
If you want to dive deeper into how Snips components communicate together, check out the specification of the `hermes-protocol` [here](https://docs.snips.ai/ressources/hermes-protocol).
You can also check this repository for other language bindings.
### API
*Coming soon.*
## Release Checklist
Everytime you need to perform a release, do the following steps :
- [ ] Commit all changes to the project for said release
- [ ] Write all the changes introduced in the Changelog (HISTORY.rst file) and commit it
- [ ] Run tests
- [ ] Bump the version and commit it
- [ ] Upload to PyPI
## History
### 0.1.27 (2019-01-07)
* Fixed broken API introduced in `0.1.26` with the publish_continue_session method of the Hermes class.
* Cast any string that goes in the mqtt_server_adress parameter in the constructor of the Hermes class to be a 8-bit string.
### 0.1.26 (2019-01-02)
* LICENSING : This wheel now has the same licenses as the parent project : APACHE-MIT.
* Subscription to not recognized intent messages is added to the API. You can now write your own callbacks to handle unrecognized intents.
* Adds send_intent_not_recognized flag to continue session : indicate whether the dialogue manager should handle non recognized intents by itself or sent them as an `IntentNotRecognizedMessage` for the client to handle.
### 0.1.25 (2018-12-13)
* Better error handling : Errors from wrapped C library throw a LibException with detailled errors.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
Close
Hashes for hermes_python-0.1.27-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a4fe41b9d3a15677985e894d51ac2e0e2d724b62d06472c23bc761f79a90973 |
|
MD5 | 55707eb4c2b7206c816e2ffff4c285bc |
|
BLAKE2b-256 | 96d93f5e20d93300a3111966b6911cd5beef258071cea4467b7f00a599c816fc |
Close
Hashes for hermes_python-0.1.27-cp37-cp37m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60d6ca922e89221b15c1cf3af82fa353c61ecd237bc0a99ff016cd384a36e131 |
|
MD5 | 79f60cf04b76577cb4b55c2406fdd384 |
|
BLAKE2b-256 | 22f0bc91520415cc9463a26150c4349a446350eb68463a1ad8749f6c40b749be |
Close
Hashes for hermes_python-0.1.27-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd27d1211cb30a23238b7ff932983ee7b2752b617ea347f4e230c155d2fb8091 |
|
MD5 | 4d4a45bf0e09b63f2671e79e878f6d6c |
|
BLAKE2b-256 | 45dba6cb81dd74b6291f6bcd2b5278e6cc01286c9013ab4de3b28b501bc28c67 |
Close
Hashes for hermes_python-0.1.27-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae65a34f8d33e8ecd9f247a9b5c77209ffa97fc4dc62f7cbb3414fceb105a774 |
|
MD5 | 55b543c4d4f6115cc71e020469107687 |
|
BLAKE2b-256 | ef25408ca2f62d88627cbdb4d18a3b850eff24e092a24ae52c8f5a34c2f5e570 |
Close
Hashes for hermes_python-0.1.27-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 344c8eca38d66f64fe497f5e00c9287791fa4745a17f2dc8910cf1340b4f2d7c |
|
MD5 | 2fd4e4549932bff7c9aa46bcde207cbd |
|
BLAKE2b-256 | 16ddb13cefe139f9fb45ed8f644a8a66e923faa664915f3f810afe8f0cc85e19 |
Close
Hashes for hermes_python-0.1.27-cp35-cp35m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6a4f73e7ce5852d98cbdfec6a9e2e8de542556fcafd501a851b127f81a87e25 |
|
MD5 | 7d5a51729442d87675c657bc0ab09f6d |
|
BLAKE2b-256 | 48413414b811740b015b1369107e61dee4020325e05e9307c1cab5c69eb4a9e5 |
Close
Hashes for hermes_python-0.1.27-cp35-cp35m-linux_armv6l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fc1a426f06947b76a93a669e8ac1cbcb84449512a1c2bed845bf7b774dffb298 |
|
MD5 | 39caf215185c14a710ec41e95c960214 |
|
BLAKE2b-256 | 7cdb5fcd75324cca2a7aaa0487da394e82a51c072fc327f29a44dadfdf71f488 |
Close
Hashes for hermes_python-0.1.27-cp34-cp34m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f108baf1763d1a30dd361fd00bbf3f198d581756fb5d17903aa571b57510e39b |
|
MD5 | 5efae7a18751f14ed692bb2869bd92cd |
|
BLAKE2b-256 | 10fd4501fff47ab8d3b02eeb34f087661fbf75d869f5d2aa6c05d4a9075b88a7 |
Close
Hashes for hermes_python-0.1.27-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b84322df2390e964f74e5642b4f9e64ff968f342970b3befc891dd15a88010a8 |
|
MD5 | fe5805429a297dbb3427a872d04bc266 |
|
BLAKE2b-256 | 1fcc383997e51c2e024e3c726f205445b5297cd1c09ce42924983eb0e1f6d470 |
Close
Hashes for hermes_python-0.1.27-cp27-cp27mu-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5f0b16669abdb295f63f0d497554addd71737eac42177e9797c4561ae6ac5cc |
|
MD5 | 61ecfc288e60c61ab697a1792a2ed28f |
|
BLAKE2b-256 | 1e8f18ce0506465c72e7dfd5d5b1e387aa87b26440f5aa88fe1371353388285b |
Close
Hashes for hermes_python-0.1.27-cp27-cp27mu-linux_armv6l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f20a691611312aad8d234d606228458b61b4826ca2ea7e3b7111aa8c9022a268 |
|
MD5 | dcd47171a3824319b80eb8fe430b9d67 |
|
BLAKE2b-256 | 2f6c62355ec92ea26edfe2d3e6b92bcab8f7293deb28643013b8f727d2bbd7cc |
Close
Hashes for hermes_python-0.1.27-cp27-cp27m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e6c57c48028a6410a97d34d35e454fbccca27ebf4799aaf34cb861e8dcc3b14c |
|
MD5 | 790ec37aec216b8221f0972922fb3bf5 |
|
BLAKE2b-256 | 13aaa7839b36881e49b2a357b23e33b7eadc92477ad78cc466a2ed2e648ffd22 |
Close
Hashes for hermes_python-0.1.27-cp27-cp27m-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 321c227e586a20ae8931525a37e9f72a657b47fb6b30ed03d3b6c948dbdb3bae |
|
MD5 | 6e90b1b9b6a703cc84f6c996caa0eb4e |
|
BLAKE2b-256 | 3774c4f6e909a13407608921881b7ff46baee7adb5749c179954f22f792f28a3 |