Skip to content

Commit

Permalink
Update requirements.txt (#384)
Browse files Browse the repository at this point in the history
* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* update imports

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* bump utils

* update more imports

* update imports

* bump OPM for deprecation warnings supression

* Update requirements.txt

* Update mycroft.txt

* Update extra-deprecated.txt

* Update extra-deprecated.txt

* more compat imports

* dedup tests in workshop

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt

* Update requirements.txt
  • Loading branch information
JarbasAl authored Dec 29, 2023
1 parent 56bc37e commit 835ac34
Show file tree
Hide file tree
Showing 32 changed files with 64 additions and 448 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ jobs:
sudo apt-get update
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev
python -m pip install build wheel
- name: Install core repo
run: |
pip install -e .[mycroft,deprecated]
- name: Install test dependencies
run: |
pip install -r requirements/tests.txt
Expand All @@ -60,7 +57,9 @@ jobs:
pip install ./test/end2end/skill-ovos-fallback-unknownv1
pip install ./test/end2end/skill-converse_test
pip install ./test/end2end/skill-ovos-schedule
pip install git+https://github.com/OpenVoiceOS/ovos-utils
- name: Install core repo
run: |
pip install -e .[mycroft,deprecated]
- name: Run unittests
run: |
pytest --cov=ovos_core --cov-report xml test/unittests
Expand Down
2 changes: 1 addition & 1 deletion mycroft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ovos_config.config import Configuration
from ovos_bus_client.message import Message

from ovos_utils.intents import AdaptIntent, IntentBuilder, Intent
from ovos_workshop.intents import IntentBuilder, Intent
from ovos_workshop.decorators import intent_handler, intent_file_handler, adds_context, removes_context
from ovos_workshop.skills.mycroft_skill import MycroftSkill
from ovos_workshop.skills.fallback import FallbackSkill
Expand Down
2 changes: 1 addition & 1 deletion mycroft/audio/interface.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# backwards compat imports
# TODO - import the OCP compat audio service instead of classic
from ovos_utils.skills.audioservice import ClassicAudioServiceInterface as AudioService, ensure_uri
from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService, ensure_uri
12 changes: 2 additions & 10 deletions mycroft/deprecated/audio/services/simple/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from ovos_plugin_manager.templates.audio import AudioBackend
from ovos_bus_client.message import Message
from ovos_utils.log import LOG
from ovos_utils.sound import play_wav, play_ogg, play_mp3
from ovos_utils.sound import play_audio
import mimetypes
import re
from requests import Session
Expand Down Expand Up @@ -117,15 +117,7 @@ def _play(self, message):
# Replace file:// uri's with normal paths
track = track.replace('file://', '')
try:
if 'mpeg' in mime[1]:
self.process = play_mp3(track)
elif 'ogg' in mime[1]:
self.process = play_ogg(track)
elif 'wav' in mime[1]:
self.process = play_wav(track)
else:
# If no mime info could be determined guess mp3
self.process = play_mp3(track)
self.process = play_audio(track)
except FileNotFoundError as e:
LOG.error('Couldn\'t play audio, {}'.format(repr(e)))
self.process = None
Expand Down
7 changes: 2 additions & 5 deletions mycroft/deprecated/skills/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@
from os import walk
from os.path import splitext, join
from ovos_backend_client.pairing import is_paired
from ovos_utils.enclosure.api import EnclosureAPI
from ovos_bus_client.apis.enclosure import EnclosureAPI
from mycroft.util.format import expand_options
from ovos_utils.log import LOG
from ovos_utils.intents.intent_service_interface import munge_regex, to_alnum
from ovos_workshop.intents import munge_regex, to_alnum

RASPBERRY_PI_PLATFORMS = ('mycroft_mark_1', 'picroft', 'mycroft_mark_2pi')

ONE_MINUTE = 60

# these 2 methods are maintained as part of ovos_utils but need to be available from this location for compatibility
from ovos_utils.skills.settings import get_local_settings, save_settings


def skill_is_blacklisted(skill):
"""DEPRECATED: do not use, method only for api backwards compatibility
Expand Down
2 changes: 1 addition & 1 deletion mycroft/skills/audioservice.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# this was moved in order to allow importing it without dragging skills service dependencies
from ovos_utils.skills.audioservice import ClassicAudioServiceInterface as AudioService
from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService
2 changes: 1 addition & 1 deletion mycroft/skills/common_play_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from abc import ABC, abstractmethod
from ovos_bus_client.message import Message
from ovos_workshop.skills.mycroft_skill import MycroftSkill
from ovos_utils.skills.audioservice import ClassicAudioServiceInterface as AudioService
from ovos_bus_client.apis.ocp import ClassicAudioServiceInterface as AudioService


class CPSMatchLevel(Enum):
Expand Down
2 changes: 1 addition & 1 deletion mycroft/skills/intent_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from ovos_core.intent_services import IntentService as _IS
from ovos_utils.log import LOG
# compat imports
from ovos_utils.intents.intent_service_interface import open_intent_envelope
from ovos_workshop.intents import open_intent_envelope


class IntentService(_IS):
Expand Down
2 changes: 1 addition & 1 deletion mycroft/skills/intent_service_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@
"""The intent service interface offers a unified wrapper class for the
Intent Service. Including both adapt and padatious.
"""
from ovos_utils.intents.intent_service_interface import IntentServiceInterface, IntentQueryApi, open_intent_envelope
from ovos_workshop.intents import IntentServiceInterface, open_intent_envelope

3 changes: 1 addition & 2 deletions mycroft/skills/intent_services/adapt_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,5 @@
"""An intent parsing service using the Adapt parser."""
from adapt.context import ContextManagerFrame
from adapt.engine import IntentDeterminationEngine
from ovos_utils.intents import AdaptIntent, IntentBuilder, Intent
from ovos_workshop.intents import Intent as AdaptIntent, IntentBuilder, Intent
from ovos_core.intent_services.adapt_service import ContextManager, AdaptService
from ovos_utils.intents import AdaptIntent, IntentBuilder, Intent
2 changes: 1 addition & 1 deletion mycroft/skills/mycroft_skill/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.
#
from ovos_workshop.skills.mycroft_skill import MycroftSkill
from ovos_utils.messagebus import get_handler_name
from ovos_utils.events import get_handler_name
from mycroft.skills.mycroft_skill.decorators import (intent_handler,
intent_file_handler,
resting_screen_handler,
Expand Down
2 changes: 1 addition & 1 deletion mycroft/skills/mycroft_skill/event_container.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Deprecated - the utils here are now part of ovos_utils
from ovos_utils.messagebus import unmunge_message, get_handler_name, create_wrapper, create_basic_wrapper, EventContainer
from ovos_utils.events import unmunge_message, get_handler_name, create_wrapper, create_basic_wrapper, EventContainer
11 changes: 5 additions & 6 deletions mycroft/skills/mycroft_skill/mycroft_skill.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
"""Common functionality relating to the implementation of mycroft skills."""

# backwards compat imports, do not delete!
from ovos_utils.intents import Intent, IntentBuilder
from ovos_workshop.intents import Intent, IntentBuilder, IntentServiceInterface, to_alnum
from ovos_utils.skills import get_non_properties
from ovos_workshop.skills.base import SkillGUI
from ovos_bus_client.message import Message, dig_for_message
from mycroft.metrics import report_metric
from ovos_bus_client.util.scheduler import EventScheduler, EventSchedulerInterface
from mycroft.skills.intent_service_interface import IntentServiceInterface
from ovos_utils.messagebus import get_handler_name, create_wrapper, EventContainer
from ovos_utils.enclosure.api import EnclosureAPI
from ovos_utils.messagebus import get_message_lang
from ovos_utils.events import get_handler_name, create_wrapper, EventContainer
from ovos_bus_client.apis.enclosure import EnclosureAPI
from ovos_bus_client.util import get_message_lang

from mycroft.deprecated.skills import (
read_vocab_file, read_value_file, read_translated_file,
load_vocabulary, load_regex, to_alnum)
load_vocabulary, load_regex)
from mycroft.deprecated.skills.settings import SettingsMetaUploader
from ovos_workshop.skills.mycroft_skill import MycroftSkill
3 changes: 1 addition & 2 deletions mycroft/skills/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,5 @@
# backwards compat imports
from mycroft.deprecated.skills.settings import SkillSettingsDownloader, SettingsMetaUploader, load_remote_settings_cache, \
save_remote_settings_cache, REMOTE_CACHE
# these 2 methods are maintained as part of ovos_utils but need to be available from this location for compatibility
from ovos_utils.skills.settings import get_local_settings, save_settings

from ovos_workshop.settings import SkillSettingsManager
2 changes: 1 addition & 1 deletion mycroft/skills/skill_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#
"""Handling of skill data such as intents and regular expressions."""
# backwards compat imports, do not delete
from ovos_utils.intents.intent_service_interface import munge_intent_parser
from ovos_workshop.intents import munge_intent_parser
from ovos_workshop.resource_files import SkillResourceTypes, ResourceType, ResourceFile, \
QmlFile, DialogFile, VocabularyFile, NamedValueFile, ListFile, TemplateFile, RegexFile, WordFile, \
CoreResources, UserResources, SkillResources, RegexExtractor, locate_base_directories, \
Expand Down
4 changes: 2 additions & 2 deletions mycroft/skills/skill_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@

# backwards compat imports do not delete
from mycroft.deprecated.skills.settings import SettingsMetaUploader
from ovos_plugin_manager.skills import find_skill_plugins
from ovos_plugin_manager.skills import find_skill_plugins, get_default_skills_directory
from ovos_workshop.skill_launcher import SKILL_MAIN_MODULE, get_skill_directories,\
get_default_skills_directory, remove_submodule_refs, load_skill_module, get_skill_class, \
remove_submodule_refs, load_skill_module, get_skill_class, \
get_create_skill_function, SkillLoader as _SL, PluginSkillLoader as _PSL


Expand Down
4 changes: 2 additions & 2 deletions mycroft/util/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
from __future__ import absolute_import

from ovos_utils import camel_case_split
from ovos_utils.sound import play_ogg, play_mp3, play_wav
from mycroft.util.audio_utils import (play_audio_file, record, find_input_device)
from ovos_utils.sound import play_audio as play_ogg, play_audio as play_mp3, play_audio as play_wav
from mycroft.util.audio_utils import (play_audio_file, find_input_device)
from mycroft.util.file_utils import (
read_stripped_lines,
read_dict,
Expand Down
10 changes: 4 additions & 6 deletions mycroft/util/audio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@
"""
import re
from ovos_utils.log import LOG
from ovos_utils.sound import play_acknowledge_sound, play_listening_sound, \
play_end_listening_sound, play_error_sound, record, play_audio, \
play_ogg as _po, play_wav as _pw, play_mp3 as _pm
from ovos_utils.sound import play_audio
try:
import pyaudio
except ImportError:
Expand Down Expand Up @@ -56,7 +54,7 @@ def play_wav(uri, environment=None):
Returns: subprocess.Popen object or None if operation failed
"""
return _pw(uri, environment=environment)
return play_audio(uri, environment=environment)


def play_mp3(uri, environment=None):
Expand All @@ -72,7 +70,7 @@ def play_mp3(uri, environment=None):
Returns: subprocess.Popen object or None if operation failed
"""
return _pm(uri, environment=environment)
return play_audio(uri, environment=environment)


def play_ogg(uri, environment=None):
Expand All @@ -88,7 +86,7 @@ def play_ogg(uri, environment=None):
Returns: subprocess.Popen object, or None if operation failed
"""
return _po(uri, environment=environment)
return play_audio(uri, environment=environment)


def find_input_device(device_name):
Expand Down
2 changes: 1 addition & 1 deletion ovos_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

from ovos_bus_client import MessageBusClient
from ovos_bus_client.util.scheduler import EventScheduler
from ovos_utils.skills.api import SkillApi
from ovos_workshop.skills.api import SkillApi
from ovos_core.intent_services import IntentService
from ovos_core.skill_manager import SkillManager, on_error, on_stopping, on_ready, on_alive, on_started
from ovos_utils import wait_for_exit_signal
Expand Down
4 changes: 2 additions & 2 deletions ovos_core/intent_services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from ovos_core.intent_services.fallback_service import FallbackService
from ovos_core.intent_services.padacioso_service import PadaciosoService
from ovos_core.transformers import MetadataTransformersService, UtteranceTransformersService
from ovos_utils.intents.intent_service_interface import open_intent_envelope
from ovos_workshop.intents import open_intent_envelope
from ovos_utils.log import LOG, deprecated, log_deprecation
from ovos_utils.messagebus import get_message_lang
from ovos_bus_client.util import get_message_lang
from ovos_utils.metrics import Stopwatch

try:
Expand Down
4 changes: 2 additions & 2 deletions ovos_core/intent_services/commonqa_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import ovos_core.intent_services
from ovos_utils import flatten_list
from ovos_utils.enclosure.api import EnclosureAPI
from ovos_bus_client.apis.enclosure import EnclosureAPI
from ovos_utils.log import LOG
from ovos_utils.messagebus import get_message_lang
from ovos_bus_client.util import get_message_lang
from ovos_workshop.resource_files import CoreResources

EXTENSION_TIME = 10
Expand Down
2 changes: 1 addition & 1 deletion ovos_core/intent_services/converse_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ovos_config.locale import setup_locale
from ovos_utils import flatten_list
from ovos_utils.log import LOG
from ovos_utils.messagebus import get_message_lang
from ovos_bus_client.util import get_message_lang
from ovos_workshop.permissions import ConverseMode, ConverseActivationMode

import ovos_core.intent_services
Expand Down
4 changes: 2 additions & 2 deletions ovos_core/skill_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@
from ovos_config.config import Configuration
from ovos_config.locations import get_xdg_config_save_path
from ovos_plugin_manager.skills import find_skill_plugins
from ovos_utils.enclosure.api import EnclosureAPI
from ovos_bus_client.apis.enclosure import EnclosureAPI
from ovos_utils.file_utils import FileWatcher
from ovos_utils.gui import is_gui_connected
from ovos_utils.log import LOG
from ovos_utils.network_utils import is_connected
from ovos_utils.process_utils import ProcessStatus, StatusCallbackMap, ProcessState
from ovos_utils.skills.locations import get_skill_directories
from ovos_plugin_manager.skills import get_skill_directories
from ovos_workshop.skill_launcher import SKILL_MAIN_MODULE
from ovos_workshop.skill_launcher import SkillLoader, PluginSkillLoader

Expand Down
3 changes: 2 additions & 1 deletion requirements/extra-deprecated.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
msm
mycroft-messagebus-client
mock_msm>=0.9
ovos_cli_client
python-vlc>=1.1.2
pyalsaaudio>=0.8
pyserial>=3.0
pillow>=8.3
pillow>=8.3
12 changes: 5 additions & 7 deletions requirements/mycroft.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
mycroft-messagebus-client

# ovos modules for compat with mycroft namespace
ovos_PHAL<0.1.0, >=0.0.5a9
ovos-audio~=0.0, >=0.0.2a14
ovos_PHAL<0.1.0, >=0.0.5a14
ovos-audio~=0.0, >=0.0.2a32
ovos-listener~=0.0, >=0.0.2a13
ovos-gui~=0.0, >=0.0.3a11
ovos-messagebus~=0.0, >=0.0.4a1
ovos-gui~=0.0, >=0.0.4a5
ovos-messagebus~=0.0, >=0.0.4a6

# default plugins
ovos-stt-plugin-server>=0.0.3, <0.1.0
Expand All @@ -16,7 +14,7 @@ ovos-ww-plugin-pocketsphinx~=0.1
ovos-ww-plugin-precise~=0.1
ovos-vad-plugin-webrtcvad>=0.0.1, <0.1.0

ovos_plugin_common_play>=0.0.6a4, <0.1.0
ovos_plugin_common_play>=0.0.6a10, <0.1.0
# ovos-ocp-youtube-plugin~=0.0, >=0.0.1
ovos-ocp-m3u-plugin>=0.0.1,<0.1.0
ovos-ocp-rss-plugin>=0.0.2,<0.1.0
Expand Down
16 changes: 8 additions & 8 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ python-dateutil>=2.6, <3.0
watchdog>=2.1, <3.0
combo-lock>=0.2.2, <0.3

padacioso~=0.2, >=0.2.1a8
padacioso~=0.2, >=0.2.1
adapt-parser>=1.0.0, <2.0.0

ovos-bus-client<0.1.0, >=0.0.6a10
ovos-utils<0.1.0, >=0.0.36a10
ovos-plugin-manager<0.1.0, >=0.0.24a9
ovos-config~=0.0,>=0.0.12a3
ovos-utils==0.0.37
ovos_bus_client<0.1.0, >=0.0.8a2
ovos-plugin-manager<0.1.0, >=0.0.25a4
ovos-config~=0.0,>=0.0.12
ovos-lingua-franca>=0.4.7
ovos-backend-client>=0.1.0a12
ovos-workshop<0.1.0, >=0.0.13a16
ovos-backend-client~=0.1.0
ovos-workshop<0.1.0, >=0.0.15a5

# provides plugins and classic machine learning framework
ovos-classifiers<0.1.0, >=0.0.0a37
ovos-classifiers<0.1.0, >=0.0.0a39
35 changes: 1 addition & 34 deletions test/integrationtests/util/test_audio_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
from unittest import TestCase, mock

from test.util import Anything
from mycroft.util import (play_ogg, play_mp3, play_wav, play_audio_file,
record)
from mycroft.util import (play_ogg, play_mp3, play_wav, play_audio_file)
from mycroft.util.file_utils import get_temp_path

test_config = {
Expand Down Expand Up @@ -130,35 +129,3 @@ def test_play_audio_file(self, mock_subprocess, mock_conf):
mock_subprocess.Popen.assert_called_once_with(['mock_ogg',
'insult.ogg'],
env=Anything())


@mock.patch('ovos_utils.sound.subprocess')
class TestRecordSounds(TestCase):
def test_record_with_duration(self, mock_subprocess):
mock_proc = mock.Mock()(name='mock process')
mock_subprocess.Popen.return_value = mock_proc
rate = 16000
channels = 1
filename = get_temp_path('test.wav')
duration = 42
res = record(filename, duration, rate, channels)
mock_subprocess.Popen.assert_called_once_with(['arecord',
'-r', str(rate),
'-c', str(channels),
'-d', str(duration),
filename])
self.assertEqual(res, mock_proc)

def test_record_without_duration(self, mock_subprocess):
mock_proc = mock.Mock(name='mock process')
mock_subprocess.Popen.return_value = mock_proc
rate = 16000
channels = 1
filename = get_temp_path('test.wav')
duration = 0
res = record(filename, duration, rate, channels)
mock_subprocess.Popen.assert_called_once_with(['arecord',
'-r', str(rate),
'-c', str(channels),
filename])
self.assertEqual(res, mock_proc)
Loading

0 comments on commit 835ac34

Please sign in to comment.