Skip to content

Commit

Permalink
chore: fix pyee import, maintain backwards compat (#140)
Browse files Browse the repository at this point in the history
* Update pyee requirement from <12.0.0,>=8.1.0 to >=8.1.0,<13.0.0

Updates the requirements on [pyee](https://github.com/jfhbrook/pyee) to permit the latest version.
- [Release notes](https://github.com/jfhbrook/pyee/releases)
- [Changelog](https://github.com/jfhbrook/pyee/blob/main/CHANGELOG.md)
- [Commits](jfhbrook/pyee@8.1.0...v12.0.0)

---
updated-dependencies:
- dependency-name: pyee
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix import, maintain backwards compat

* catch ModuleNotFoundError

* validate in test pipelines

* quotes

* better testing

* switch back to pyee 8

* Update unit_tests.yml

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JarbasAI <[email protected]>
  • Loading branch information
3 people authored Nov 21, 2024
1 parent ea48071 commit 85b4729
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 28 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
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
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 85b4729

Please sign in to comment.