diff --git a/CHANGELOG.md b/CHANGELOG.md index fdada5a..406fe8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,12 +1,13 @@ # Changelog -## [0.5.0a1](https://github.com/OpenVoiceOS/ovos-utils/tree/0.5.0a1) (2024-11-20) +## [0.5.1a1](https://github.com/OpenVoiceOS/ovos-utils/tree/0.5.1a1) (2024-11-21) -[Full Changelog](https://github.com/OpenVoiceOS/ovos-utils/compare/0.4.1...0.5.0a1) +[Full Changelog](https://github.com/OpenVoiceOS/ovos-utils/compare/0.5.0...0.5.1a1) **Merged pull requests:** -- feat:oauth utils to ovos-utils and deprecate backend-client [\#301](https://github.com/OpenVoiceOS/ovos-utils/pull/301) ([JarbasAl](https://github.com/JarbasAl)) +- fix: remove mycroft-bus-client compat [\#304](https://github.com/OpenVoiceOS/ovos-utils/pull/304) ([JarbasAl](https://github.com/JarbasAl)) +- chore: support newer pyee [\#303](https://github.com/OpenVoiceOS/ovos-utils/pull/303) ([mikejgray](https://github.com/mikejgray)) diff --git a/ovos_utils/events.py b/ovos_utils/events.py index cef7c16..93b420a 100644 --- a/ovos_utils/events.py +++ b/ovos_utils/events.py @@ -3,7 +3,7 @@ from inspect import signature from typing import Callable, Optional, Union -from ovos_utils.fakebus import Message, FakeBus, dig_for_message +from ovos_utils.fakebus import FakeMessage as Message, FakeBus, dig_for_message from ovos_utils.file_utils import to_alnum from ovos_utils.log import LOG diff --git a/ovos_utils/fakebus.py b/ovos_utils/fakebus.py index d08300f..ff24610 100644 --- a/ovos_utils/fakebus.py +++ b/ovos_utils/fakebus.py @@ -60,7 +60,7 @@ def on_message(self, *args): message = args[0] else: message = args[1] - parsed_message = Message.deserialize(message) + parsed_message = FakeMessage.deserialize(message) try: # replicate side effects from ovos_bus_client.session import Session, SessionManager sess = Session.from_message(parsed_message) @@ -173,12 +173,6 @@ def __instancecheck__(self, instance): return True except ImportError: pass - try: - from mycroft_bus_client.message import Message as _MycroftMessage - if isinstance(instance, _MycroftMessage): - return True - except ImportError: - pass return super().__instancecheck__(instance) @@ -192,11 +186,8 @@ def __new__(cls, *args, **kwargs): return _M(*args, **kwargs) except ImportError: pass - try: # some old install that upgraded during migration period - from mycroft_bus_client import Message as _M - return _M(*args, **kwargs) - except ImportError: # FakeMessage - return super().__new__(cls) + return super().__new__(cls) + def __init__(self, msg_type, data=None, context=None): """Used to construct a message object @@ -339,9 +330,3 @@ def publish(self, msg_type, data, context=None): return FakeMessage(msg_type, data, context=new_context) - -class Message(FakeMessage): - def __int__(self, *args, **kwargs): - log_deprecation(f"Import from ovos_bus_client.message directly", - "0.1.0") - FakeMessage.__init__(self, *args, **kwargs) diff --git a/ovos_utils/messagebus.py b/ovos_utils/messagebus.py deleted file mode 100644 index 698685f..0000000 --- a/ovos_utils/messagebus.py +++ /dev/null @@ -1 +0,0 @@ -from ovos_utils.fakebus import dig_for_message, FakeMessage, Message, FakeBus diff --git a/ovos_utils/version.py b/ovos_utils/version.py index 8b3c775..7dc4fa3 100644 --- a/ovos_utils/version.py +++ b/ovos_utils/version.py @@ -1,6 +1,6 @@ # START_VERSION_BLOCK VERSION_MAJOR = 0 VERSION_MINOR = 5 -VERSION_BUILD = 0 -VERSION_ALPHA = 0 +VERSION_BUILD = 1 +VERSION_ALPHA = 1 # END_VERSION_BLOCK diff --git a/test/unittests/test_event_scheduler.py b/test/unittests/test_event_scheduler.py index 5f2dcd7..aa24d69 100644 --- a/test/unittests/test_event_scheduler.py +++ b/test/unittests/test_event_scheduler.py @@ -4,10 +4,8 @@ import unittest import time -from pyee import ExecutorEventEmitter - from unittest.mock import MagicMock, patch -from ovos_utils.messagebus import FakeBus +from ovos_utils.fakebus import FakeBus from ovos_bus_client.util.scheduler import EventScheduler, EventSchedulerInterface @@ -107,8 +105,6 @@ def test_shutdown(self): def f(message): print('TEST FUNC') - bus = ExecutorEventEmitter() - es = EventSchedulerInterface('tester') es.set_bus(FakeBus()) es.set_id('id') @@ -120,4 +116,4 @@ def f(message): es.shutdown() # Check that the reference to the function has been removed from the # bus emitter - self.assertTrue(len(bus._events.get('id:f', [])) == 0) + self.assertTrue(len(es.bus.ee._events.get('id:f', [])) == 0) diff --git a/test/unittests/test_events.py b/test/unittests/test_events.py index 18c5a5e..ac5a847 100644 --- a/test/unittests/test_events.py +++ b/test/unittests/test_events.py @@ -7,7 +7,7 @@ from time import time from unittest.mock import Mock -from ovos_utils.fakebus import FakeBus, Message +from ovos_utils.fakebus import FakeBus, FakeMessage as Message class TestEvents(unittest.TestCase):