Skip to content

Commit

Permalink
Merge pull request #144 from OpenVoiceOS/release-1.0.4a1
Browse files Browse the repository at this point in the history
Release 1.0.4a1
  • Loading branch information
JarbasAl authored Nov 21, 2024
2 parents ea48071 + a03439b commit b4355b0
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 36 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,41 @@ on:
branches:
- dev
paths-ignore:
- 'ovos_bus_client/version.py'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
- "ovos_bus_client/version.py"
- "examples/**"
- ".github/**"
- ".gitignore"
- "LICENSE"
- "CHANGELOG.md"
- "MANIFEST.in"
- "README.md"
- "scripts/**"
push:
branches:
- master
paths-ignore:
- 'ovos_bus_client/version.py'
- 'requirements/**'
- 'examples/**'
- '.github/**'
- '.gitignore'
- 'LICENSE'
- 'CHANGELOG.md'
- 'MANIFEST.in'
- 'README.md'
- 'scripts/**'
- "ovos_bus_client/version.py"
- "examples/**"
- ".github/**"
- ".gitignore"
- "LICENSE"
- "CHANGELOG.md"
- "MANIFEST.in"
- "README.md"
- "scripts/**"
workflow_dispatch:

jobs:
unit_tests:
strategy:
matrix:
python-version: [ 3.7, 3.8, 3.9, '3.10']
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"]
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install System Dependencies
Expand All @@ -59,10 +58,14 @@ jobs:
# NOTE: additional pytest invocations should also add the --cov-append flag
# or they will overwrite previous invocations' coverage reports
# (for an example, see OVOS Skill Manager's workflow)
- name: Maintain Pyee backwards compat
run: |
pip install -U "pyee==8.1.0"
pytest --cov=ovos_bus_client --cov-report=xml --cov-append test/unittests
- name: Upload coverage
if: "${{ matrix.python-version == '3.9' }}"
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v5
with:
token: ${{secrets.CODECOV_TOKEN}}
files: coverage.xml
verbose: true
verbose: true
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# Changelog

## [1.0.3a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/1.0.3a1) (2024-11-21)
## [1.0.4a1](https://github.com/OpenVoiceOS/ovos-bus-client/tree/1.0.4a1) (2024-11-21)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/1.0.2...1.0.3a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-bus-client/compare/1.0.3...1.0.4a1)

**Merged pull requests:**

- fix: remove dead code [\#141](https://github.com/OpenVoiceOS/ovos-bus-client/pull/141) ([JarbasAl](https://github.com/JarbasAl))
- chore: Update README.md [\#143](https://github.com/OpenVoiceOS/ovos-bus-client/pull/143) ([JarbasAl](https://github.com/JarbasAl))
- chore: fix pyee import, maintain backwards compat [\#140](https://github.com/OpenVoiceOS/ovos-bus-client/pull/140) ([mikejgray](https://github.com/mikejgray))



Expand Down
54 changes: 51 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,54 @@

# OpenVoiceOS Bus Client

This module is a simple interface for the mycroft messagebus and can be used to connect to ovos, send messages and react to messages sent by the OpenVoiceOS system.
This module is a simple interface for the OVOS messagebus and can be used to connect to OVOS, send messages and react to messages sent by the OpenVoiceOS system.


## MycroftBusClient()

The `MycroftBusClient()` object can be setup to connect to any host and port as well as any endpont on that host. this makes it quite versitile and will work on the main bus as well as on a gui bus. If no arguments are provided it will try to connect to a local instance of OVOS on the default endpoint and port.

> NOTE: we kept the original pre-fork class name for compatibility reasons
## Message()

The `Message` object is a representation of the messagebus message, this will always contain a message type but can also contain data and context. Data is usually real information while the context typically contain information on where the message originated or who the intended recipient is.

```python
Message('MESSAGE_TYPE', data={'meaning': 42}, context={'origin': 'A.Dent'})
```

## Examples

Below are some a couple of simple cases for sending a message on the bus as well
as reacting to messages on the bus

### Sending a message on the bus.

```python
from ovos_bus_client import MessageBusClient, Message

print('Setting up client to connect to a local OVOS instance')
client = MessageBusClient()
client.run_in_thread()

print('Sending speak message...')
client.emit(Message('speak', data={'utterance': 'Hello World'}))
```

### Catching a message on the messagebus

```python
from ovos_bus_client import MessageBusClient, Message

print('Setting up client to connect to a local OVOS instance')
client = MessageBusClient()

def print_utterance(message):
print('OVOS said "{}"'.format(message.data.get('utterance')))


print('Registering handler for speak message...')
client.on('speak', print_utterance)

This module extends the mycroft-messagebus-client with a Session implementation
client.run_forever()
```
6 changes: 5 additions & 1 deletion ovos_bus_client/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
from uuid import uuid4

from ovos_utils.log import LOG, deprecated
from pyee import ExecutorEventEmitter
try:
from pyee import ExecutorEventEmitter
except (ImportError, ModuleNotFoundError):
from pyee.executor import ExecutorEventEmitter

from websocket import (WebSocketApp,
WebSocketConnectionClosedException,
WebSocketException)
Expand Down
4 changes: 2 additions & 2 deletions ovos_bus_client/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 1
VERSION_MINOR = 0
VERSION_BUILD = 3
VERSION_ALPHA = 0
VERSION_BUILD = 4
VERSION_ALPHA = 1
# END_VERSION_BLOCK
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ovos-config>=0.0.12,<1.0.0
ovos-utils>=0.3.5,<1.0.0
websocket-client>=0.54.0
pyee>=8.1.0, < 12.0.0
pyee>= 8.1.0, < 13.0.0
orjson
5 changes: 4 additions & 1 deletion test/unittests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
import unittest
from unittest.mock import call, Mock, patch

from pyee import ExecutorEventEmitter
try:
from pyee import ExecutorEventEmitter
except (ImportError, ModuleNotFoundError):
from pyee.executor import ExecutorEventEmitter

from ovos_bus_client.message import Message
from ovos_bus_client.client.client import MessageBusClient, GUIWebsocketClient
Expand Down
6 changes: 5 additions & 1 deletion test/unittests/test_event_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

import unittest
import time
from pyee import ExecutorEventEmitter
try:
from pyee import ExecutorEventEmitter
except (ImportError, ModuleNotFoundError):
from pyee.executor import ExecutorEventEmitter


from unittest.mock import MagicMock, patch
from ovos_utils.messagebus import FakeBus
Expand Down

0 comments on commit b4355b0

Please sign in to comment.