From 5ca16a9d5684298e4c1ad109d62b803f2123872a Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Thu, 5 Sep 2024 10:53:20 +0100 Subject: [PATCH] planned_deprecations (#254) * planned_deprecations * tests --- ovos_plugin_manager/__init__.py | 17 ------- ovos_plugin_manager/audio.py | 12 ++--- ovos_plugin_manager/audio2ipa.py | 16 ------ ovos_plugin_manager/audio_transformers.py | 18 ------- ovos_plugin_manager/coreference.py | 16 ------ ovos_plugin_manager/g2p.py | 17 ------- ovos_plugin_manager/gui.py | 16 ------ ovos_plugin_manager/keywords.py | 16 ------ ovos_plugin_manager/language.py | 16 ------ ovos_plugin_manager/metadata_transformers.py | 17 ------- ovos_plugin_manager/microphone.py | 16 ------ ovos_plugin_manager/phal.py | 16 ------ ovos_plugin_manager/postag.py | 16 ------ ovos_plugin_manager/segmentation.py | 15 ------ ovos_plugin_manager/skills.py | 2 +- ovos_plugin_manager/solvers.py | 15 ------ ovos_plugin_manager/stt.py | 42 ---------------- ovos_plugin_manager/templates/solvers.py | 2 +- ovos_plugin_manager/templates/stt.py | 16 +++--- ovos_plugin_manager/templates/tts.py | 30 +++++------ ovos_plugin_manager/text_transformers.py | 39 --------------- ovos_plugin_manager/tokenization.py | 16 ------ ovos_plugin_manager/tts.py | 52 +++----------------- ovos_plugin_manager/vad.py | 16 ------ ovos_plugin_manager/wakewords.py | 16 ------ test/unittests/test_stt.py | 11 +---- test/unittests/test_tts.py | 11 +---- 27 files changed, 39 insertions(+), 453 deletions(-) diff --git a/ovos_plugin_manager/__init__.py b/ovos_plugin_manager/__init__.py index 0d0fd980..64282511 100644 --- a/ovos_plugin_manager/__init__.py +++ b/ovos_plugin_manager/__init__.py @@ -1,19 +1,2 @@ from ovos_plugin_manager.utils import PluginTypes from ovos_plugin_manager.plugin_entry import OpenVoiceOSPlugin -from ovos_utils.log import LOG - - -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) diff --git a/ovos_plugin_manager/audio.py b/ovos_plugin_manager/audio.py index a60ff0db..370952f5 100644 --- a/ovos_plugin_manager/audio.py +++ b/ovos_plugin_manager/audio.py @@ -4,16 +4,10 @@ from ovos_config import Configuration from ovos_utils.log import log_deprecation -log_deprecation("ovos_plugin_manager.audio has been deprecated on ovos-audio, " - "move to ovos_plugin_manager.media", "0.1.0") - -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) +# TODO - restore this log in next release with updated version string +#log_deprecation("ovos_plugin_manager.audio has been deprecated on ovos-audio, " +# "move to ovos_plugin_manager.media", "1.0.0") def find_audio_service_plugins() -> dict: diff --git a/ovos_plugin_manager/audio2ipa.py b/ovos_plugin_manager/audio2ipa.py index 39738a42..9c1dcbbd 100644 --- a/ovos_plugin_manager/audio2ipa.py +++ b/ovos_plugin_manager/audio2ipa.py @@ -4,22 +4,6 @@ from ovos_utils.log import LOG -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_audio2ipa_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/audio_transformers.py b/ovos_plugin_manager/audio_transformers.py index 3f4e3b8c..f2e0f004 100644 --- a/ovos_plugin_manager/audio_transformers.py +++ b/ovos_plugin_manager/audio_transformers.py @@ -1,25 +1,7 @@ -from ovos_utils.log import LOG - from ovos_plugin_manager.templates.transformers import AudioTransformer, AudioLanguageDetector from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_audio_transformer_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/coreference.py b/ovos_plugin_manager/coreference.py index 6d58d546..0f94274c 100644 --- a/ovos_plugin_manager/coreference.py +++ b/ovos_plugin_manager/coreference.py @@ -8,22 +8,6 @@ replace_coreferences -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_coref_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/g2p.py b/ovos_plugin_manager/g2p.py index 5146ea5c..64497a15 100644 --- a/ovos_plugin_manager/g2p.py +++ b/ovos_plugin_manager/g2p.py @@ -3,23 +3,6 @@ from ovos_plugin_manager.utils import normalize_lang, PluginTypes, PluginConfigTypes from ovos_plugin_manager.templates.g2p import Grapheme2PhonemePlugin, PhonemeAlphabet from ovos_utils.log import LOG -from ovos_config import Configuration - - -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) def find_g2p_plugins() -> dict: diff --git a/ovos_plugin_manager/gui.py b/ovos_plugin_manager/gui.py index 5bd1fc73..6759a9a9 100644 --- a/ovos_plugin_manager/gui.py +++ b/ovos_plugin_manager/gui.py @@ -5,22 +5,6 @@ from ovos_utils.log import LOG -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_gui_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/keywords.py b/ovos_plugin_manager/keywords.py index 9ad3152e..1de2d34b 100644 --- a/ovos_plugin_manager/keywords.py +++ b/ovos_plugin_manager/keywords.py @@ -4,22 +4,6 @@ from ovos_plugin_manager.templates.keywords import KeywordExtractor -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_keyword_extract_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/language.py b/ovos_plugin_manager/language.py index ed9f8fec..ebf2a25c 100644 --- a/ovos_plugin_manager/language.py +++ b/ovos_plugin_manager/language.py @@ -7,22 +7,6 @@ from ovos_plugin_manager.utils import PluginTypes, PluginConfigTypes -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_tx_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/metadata_transformers.py b/ovos_plugin_manager/metadata_transformers.py index 4872404e..c70fbc8e 100644 --- a/ovos_plugin_manager/metadata_transformers.py +++ b/ovos_plugin_manager/metadata_transformers.py @@ -1,23 +1,6 @@ from ovos_plugin_manager.utils import normalize_lang, PluginTypes, \ PluginConfigTypes from ovos_plugin_manager.templates.transformers import MetadataTransformer -from ovos_utils.log import LOG - - -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) def find_metadata_transformer_plugins() -> dict: diff --git a/ovos_plugin_manager/microphone.py b/ovos_plugin_manager/microphone.py index 5a7de18a..2e8f0c84 100644 --- a/ovos_plugin_manager/microphone.py +++ b/ovos_plugin_manager/microphone.py @@ -3,22 +3,6 @@ from ovos_utils.log import LOG -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_microphone_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/phal.py b/ovos_plugin_manager/phal.py index 935f9bb9..4a8228f4 100644 --- a/ovos_plugin_manager/phal.py +++ b/ovos_plugin_manager/phal.py @@ -4,22 +4,6 @@ from ovos_utils.log import LOG -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_phal_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/postag.py b/ovos_plugin_manager/postag.py index 726b7207..4a05e09e 100644 --- a/ovos_plugin_manager/postag.py +++ b/ovos_plugin_manager/postag.py @@ -5,22 +5,6 @@ from ovos_plugin_manager.templates.postag import PosTagger -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_postag_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/segmentation.py b/ovos_plugin_manager/segmentation.py index 1b56456b..b3807574 100644 --- a/ovos_plugin_manager/segmentation.py +++ b/ovos_plugin_manager/segmentation.py @@ -5,21 +5,6 @@ from ovos_plugin_manager.templates.segmentation import Segmenter -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - def find_segmentation_plugins() -> dict: """ diff --git a/ovos_plugin_manager/skills.py b/ovos_plugin_manager/skills.py index a38093dc..b48ee3f6 100644 --- a/ovos_plugin_manager/skills.py +++ b/ovos_plugin_manager/skills.py @@ -114,7 +114,7 @@ def get_default_skills_directory(conf: Optional[dict] = None) -> str: if path_override: log_deprecation("'directory_override' is deprecated!" "add the new path to 'extra_directories' instead", - "0.1.0") + "1.0.0") skills_folder = expanduser(path_override) elif conf["skills"].get("extra_directories") and \ len(conf["skills"].get("extra_directories")) > 0: diff --git a/ovos_plugin_manager/solvers.py b/ovos_plugin_manager/solvers.py index 23c0a7a7..352d2319 100644 --- a/ovos_plugin_manager/solvers.py +++ b/ovos_plugin_manager/solvers.py @@ -5,21 +5,6 @@ from ovos_utils.log import LOG -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - def find_question_solver_plugins() -> dict: """ diff --git a/ovos_plugin_manager/stt.py b/ovos_plugin_manager/stt.py index dd92ff0c..4cd8592c 100644 --- a/ovos_plugin_manager/stt.py +++ b/ovos_plugin_manager/stt.py @@ -7,22 +7,6 @@ from ovos_plugin_manager.templates.stt import STT, StreamingSTT, StreamThread -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_stt_plugins() -> dict: """ Find all installed plugins @@ -103,25 +87,6 @@ def get_stt_config(config: dict = None, module: str = None) -> dict: class OVOSSTTFactory: """ replicates the base mycroft class, but uses only OPM enabled plugins""" - MAPPINGS = { - "mycroft": "ovos-stt-plugin-selene", - "dummy": "ovos-stt-plugin-dummy", - "google": "ovos-stt-plugin-chromium", - # "google_cloud": GoogleCloudSTT, - # "google_cloud_streaming": GoogleCloudStreamingSTT, - # "wit": WITSTT, - # "ibm": IBMSTT, - # "kaldi": KaldiSTT, - # "bing": BingSTT, - # "govivace": GoVivaceSTT, - # "houndify": HoundifySTT, - # "deepspeech_server": DeepSpeechServerSTT, - # "deepspeech_stream_server": DeepSpeechStreamServerSTT, - # "mycroft_deepspeech": MycroftDeepSpeechSTT, - # "yandex": YandexSTT - "vosk": "ovos-stt-plugin-vosk", - "vosk_streaming": "ovos-stt-plugin-vosk-streaming" - } @staticmethod def get_class(config=None): @@ -136,8 +101,6 @@ def get_class(config=None): """ config = get_stt_config(config) stt_module = config["module"] - if stt_module in OVOSSTTFactory.MAPPINGS: - stt_module = OVOSSTTFactory.MAPPINGS[stt_module] return load_stt_plugin(stt_module) @staticmethod @@ -152,11 +115,6 @@ def create(config=None): } """ stt_config = get_stt_config(config) - plugin = stt_config.get("module", "dummy") - if plugin in OVOSSTTFactory.MAPPINGS: - log_deprecation("Module mappings will be deprecated", "0.1.0") - plugin = OVOSSTTFactory.MAPPINGS[plugin] - stt_config = get_stt_config(config, plugin) try: clazz = OVOSSTTFactory.get_class(stt_config) return clazz(stt_config) diff --git a/ovos_plugin_manager/templates/solvers.py b/ovos_plugin_manager/templates/solvers.py index 85b8ce25..c40ea4cf 100644 --- a/ovos_plugin_manager/templates/solvers.py +++ b/ovos_plugin_manager/templates/solvers.py @@ -121,7 +121,7 @@ def func_wrapper(*args, **kwargs): # NOTE: deprecate this at same time we # standardize plugin namespaces to opm.XXX log_deprecation("'context' kwarg has been deprecated, " - "please pass 'lang' as it's own kwarg instead", "0.1.0") + "please pass 'lang' as it's own kwarg instead", "1.0.0") if "lang" in kwargs["context"] and "lang" not in kwargs: kwargs["lang"] = kwargs["context"]["lang"] diff --git a/ovos_plugin_manager/templates/stt.py b/ovos_plugin_manager/templates/stt.py index 70f072b2..e028cad0 100644 --- a/ovos_plugin_manager/templates/stt.py +++ b/ovos_plugin_manager/templates/stt.py @@ -64,7 +64,7 @@ def runtime_requirements(self): @property @deprecated("self.recognizer has been deprecated! " - "if you need it 'from speech_recognition import Recognizer' directly", "0.1.0") + "if you need it 'from speech_recognition import Recognizer' directly", "1.0.0") def recognizer(self): # only imported here to not drag dependency from speech_recognition import Recognizer @@ -89,7 +89,7 @@ def lang(self, val): @property @deprecated("self.keys has been deprecated! " - "implement config handling directly instead", "0.1.0") + "implement config handling directly instead", "1.0.0") def keys(self): return self._keys or self.config_core.get("keys", {}) @@ -100,7 +100,7 @@ def keys(self, val): @property @deprecated("self.credential has been deprecated! " - "implement config handling directly instead", "0.1.0") + "implement config handling directly instead", "1.0.0") def credential(self): return self._credential or self.config.get("credential", {}) @@ -111,7 +111,7 @@ def credential(self, val): @staticmethod @deprecated("self.init_language has been deprecated! " - "implement config handling directly instead", "0.1.0") + "implement config handling directly instead", "1.0.0") def init_language(config_core): lang = config_core.get("lang", "en-US") langs = lang.split("-") @@ -141,14 +141,14 @@ def available_languages(self) -> set: class TokenSTT(STT, metaclass=ABCMeta): - @deprecated("TokenSTT is deprecated, please subclass from STT directly", "0.1.0") + @deprecated("TokenSTT is deprecated, please subclass from STT directly", "1.0.0") def __init__(self, config=None): super().__init__(config) self.token = self.credential.get("token") class GoogleJsonSTT(STT, metaclass=ABCMeta): - @deprecated("GoogleJsonSTT is deprecated, please subclass from STT directly", "0.1.0") + @deprecated("GoogleJsonSTT is deprecated, please subclass from STT directly", "1.0.0") def __init__(self, config=None): super().__init__(config) if not self.credential.get("json") or self.keys.get("google_cloud"): @@ -157,7 +157,7 @@ def __init__(self, config=None): class BasicSTT(STT, metaclass=ABCMeta): - @deprecated("BasicSTT is deprecated, please subclass from STT directly", "0.1.0") + @deprecated("BasicSTT is deprecated, please subclass from STT directly", "1.0.0") def __init__(self, config=None): super().__init__(config) self.username = str(self.credential.get("username")) @@ -166,7 +166,7 @@ def __init__(self, config=None): class KeySTT(STT, metaclass=ABCMeta): - @deprecated("KeySTT is deprecated, please subclass from STT directly", "0.1.0") + @deprecated("KeySTT is deprecated, please subclass from STT directly", "1.0.0") def __init__(self, config=None): super().__init__(config) self.id = str(self.credential.get("client_id")) diff --git a/ovos_plugin_manager/templates/tts.py b/ovos_plugin_manager/templates/tts.py index caccae2a..c4fc9f96 100644 --- a/ovos_plugin_manager/templates/tts.py +++ b/ovos_plugin_manager/templates/tts.py @@ -733,7 +733,7 @@ def __del__(self): # below code is all deprecated and marked for removal in next stable release @property @deprecated("self.enclosure has been deprecated, use EnclosureAPI directly decoupled from the plugin code", - "0.1.0") + "1.0.0") def enclosure(self): """Deprecated. Accessor for the enclosure property. @@ -747,7 +747,7 @@ def enclosure(self): @enclosure.setter @deprecated("self.enclosure has been deprecated, use EnclosureAPI directly decoupled from the plugin code", - "0.1.0") + "1.0.0") def enclosure(self, val): """Deprecated. Setter for the enclosure property. @@ -758,7 +758,7 @@ def enclosure(self, val): @property @deprecated("self.filename has been deprecated, unused for a long time now", - "0.1.0") + "1.0.0") def filename(self): """Deprecated. Accessor for the filename property. @@ -770,7 +770,7 @@ def filename(self): @filename.setter @deprecated("self.filename has been deprecated, unused for a long time now", - "0.1.0") + "1.0.0") def filename(self, val): """Deprecated. Setter for the filename property. @@ -780,7 +780,7 @@ def filename(self, val): @property @deprecated("self.tts_id has been deprecated, use TTSContext().tts_id", - "0.1.0") + "1.0.0") def tts_id(self): """Deprecated. Accessor for the tts_id property. @@ -791,7 +791,7 @@ def tts_id(self): @property @deprecated("self.cache has been deprecated, use TTSContext().get_cache", - "0.1.0") + "1.0.0") def cache(self): """Deprecated. Accessor for the cache property. @@ -803,7 +803,7 @@ def cache(self): @cache.setter @deprecated("self.cache has been deprecated, use TTSContext().get_cache", - "0.1.0") + "1.0.0") def cache(self, val): """Deprecated. Setter for the cache property. @@ -813,7 +813,7 @@ def cache(self, val): TTSContext._caches[self.tts_id] = val @deprecated("get_voice was never formally adopted and is unused, it will be removed", - "0.1.0") + "1.0.0") def get_voice(self, gender, lang=None): """Deprecated. Get a valid voice for the TTS engine. @@ -827,7 +827,7 @@ def get_voice(self, gender, lang=None): return gender @deprecated("get_cache has been deprecated, use TTSContext().get_cache directly", - "0.1.0") + "1.0.0") def get_cache(self, voice=None, lang=None): """Deprecated. Get the cache associated with the TTS context. @@ -841,14 +841,14 @@ def get_cache(self, voice=None, lang=None): return self._get_ctxt().get_cache(self.audio_ext, self.config) @deprecated("clear_cache has been deprecated, use TTSContext().get_cache directly", - "0.1.0") + "1.0.0") def clear_cache(self): """Deprecated. Clear all cached files.""" cache = self._get_ctxt().get_cache(self.audio_ext, self.config) cache.clear() @deprecated("save_phonemes has been deprecated, use TTSContext().get_cache directly", - "0.1.0") + "1.0.0") def save_phonemes(self, key, phonemes): """Deprecated. Cache phonemes. @@ -865,7 +865,7 @@ def save_phonemes(self, key, phonemes): return phoneme_file @deprecated("load_phonemes has been deprecated, use TTSContext().get_cache directly", - "0.1.0") + "1.0.0") def load_phonemes(self, key): """Deprecated. Load phonemes from cache file. @@ -880,7 +880,7 @@ def load_phonemes(self, key): return phoneme_file.load() @deprecated("get_from_cache has been deprecated, use TTSContext().get_from_cache directly", - "0.1.0") + "1.0.0") def get_from_cache(self, sentence): """Deprecated. Get data from the cache. @@ -902,7 +902,7 @@ def lang(self): @lang.setter @deprecated("language is defined per request in get_tts, self.lang is not used", - "0.1.0") + "1.0.0") def lang(self, val): LOG.warning("self.lang can not be set! it comes from the bus message") @@ -1186,7 +1186,7 @@ class RemoteTTS(TTS): """ @deprecated("RemoteTTS has been deprecated, please use the regular TTS class", - "0.1.0") + "1.0.0") def __init__(self, lang, config, url, api_path, validator): super(RemoteTTS, self).__init__(lang, config, validator) self.api_path = api_path diff --git a/ovos_plugin_manager/text_transformers.py b/ovos_plugin_manager/text_transformers.py index efc277dd..4f118092 100644 --- a/ovos_plugin_manager/text_transformers.py +++ b/ovos_plugin_manager/text_transformers.py @@ -1,23 +1,6 @@ from ovos_plugin_manager.utils import normalize_lang, \ PluginTypes, PluginConfigTypes from ovos_plugin_manager.templates.transformers import UtteranceTransformer -from ovos_utils import LOG - - -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) def find_utterance_transformer_plugins() -> dict: @@ -84,25 +67,3 @@ def get_utterance_transformer_supported_langs() -> dict: from ovos_plugin_manager.utils.config import get_plugin_supported_languages return get_plugin_supported_languages(PluginTypes.UTTERANCE_TRANSFORMER) - -def find_text_transformer_plugins() -> dict: - """ - Find all installed plugins - @return: dict plugin names to entrypoints - """ - # TODO: Deprecate in 0.1.0 - LOG.warning(f"This reference is deprecated. " - f"Use `find_utterance_transformer_plugins") - return find_utterance_transformer_plugins() - - -def load_text_transformer_plugin(module_name: str) -> type(UtteranceTransformer): - """ - Get an uninstantiated class for the requested module_name - @param module_name: Plugin entrypoint name to load - @return: Uninstantiated class - """ - # TODO: Deprecate in 0.1.0 - LOG.warning(f"This reference is deprecated. " - f"Use `find_utterance_transformer_plugins") - return load_utterance_transformer_plugin(module_name) diff --git a/ovos_plugin_manager/tokenization.py b/ovos_plugin_manager/tokenization.py index 598331fa..2ce8f1ff 100644 --- a/ovos_plugin_manager/tokenization.py +++ b/ovos_plugin_manager/tokenization.py @@ -5,22 +5,6 @@ from ovos_plugin_manager.templates.tokenization import Tokenizer -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_tokenization_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/tts.py b/ovos_plugin_manager/tts.py index fe453423..b529ad3a 100644 --- a/ovos_plugin_manager/tts.py +++ b/ovos_plugin_manager/tts.py @@ -11,22 +11,6 @@ from hashlib import md5 -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_tts_plugins() -> dict: """ Find all installed plugins @@ -143,25 +127,6 @@ def get_voices(scan=False): class OVOSTTSFactory: """ replicates the base mycroft class, but uses only OPM enabled plugins""" - MAPPINGS = { - "dummy": "ovos-tts-plugin-dummy", - "mimic": "ovos-tts-plugin-mimic", - "mimic2": "ovos-tts-plugin-mimic2", - "mimic3": "ovos-tts-plugin-mimic3", - "google": "ovos-tts-plugin-google-tx", - "marytts": "ovos-tts-plugin-marytts", - # "fatts": FATTS, - # "festival": Festival, - "espeak": "ovos_tts_plugin_espeakng", - # "spdsay": SpdSay, - # "watson": WatsonTTS, - # "bing": BingTTS, - "responsive_voice": "ovos-tts-plugin-responsivevoice", - # "yandex": YandexTTS, - "polly": "ovos-tts-plugin-polly", - # "mozilla": MozillaTTS, - "pico": "ovos-tts-plugin-pico" - } @staticmethod def get_class(config=None): @@ -175,9 +140,7 @@ def get_class(config=None): } """ config = config or get_tts_config() - tts_module = config.get("module") or "dummy" - if tts_module in OVOSTTSFactory.MAPPINGS: - tts_module = OVOSTTSFactory.MAPPINGS[tts_module] + tts_module = config.get("module") or "ovos-tts-plugin-dummy" return load_tts_plugin(tts_module) @staticmethod @@ -192,13 +155,7 @@ def create(config=None): } """ tts_config = get_tts_config(config) - tts_module = tts_config.get('module', 'dummy') - if tts_module in OVOSTTSFactory.MAPPINGS: - # The configured module maps to a valid plugin; get configuration - # again to make sure any module-specific config/overrides are loaded - log_deprecation("Module mappings will be deprecated", "0.1.0") - tts_module = OVOSTTSFactory.MAPPINGS[tts_module] - tts_config = get_tts_config(config, tts_module) + tts_module = tts_config.get('module', 'ovos-tts-plugin-dummy') try: clazz = OVOSTTSFactory.get_class(tts_config) if clazz: @@ -216,3 +173,8 @@ def create(config=None): f'\nAvailable modules: {modules}') raise return tts + + +if __name__ == "__main__": + lang = "en-us" + print(find_tts_plugins()) \ No newline at end of file diff --git a/ovos_plugin_manager/vad.py b/ovos_plugin_manager/vad.py index 1715d53d..966c3edf 100644 --- a/ovos_plugin_manager/vad.py +++ b/ovos_plugin_manager/vad.py @@ -4,22 +4,6 @@ from ovos_plugin_manager.templates.vad import VADEngine -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_vad_plugins() -> dict: """ Find all installed plugins diff --git a/ovos_plugin_manager/wakewords.py b/ovos_plugin_manager/wakewords.py index f667f997..f098b64a 100644 --- a/ovos_plugin_manager/wakewords.py +++ b/ovos_plugin_manager/wakewords.py @@ -10,22 +10,6 @@ PluginTypes, PluginConfigTypes -def find_plugins(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import find_plugins - return find_plugins(*args, **kwargs) - - -def load_plugin(*args, **kwargs): - # TODO: Deprecate in 0.1.0 - LOG.warning("This reference is deprecated. " - "Import from ovos_plugin_manager.utils directly") - from ovos_plugin_manager.utils import load_plugin - return load_plugin(*args, **kwargs) - - def find_wake_word_plugins() -> dict: """ Find all installed plugins diff --git a/test/unittests/test_stt.py b/test/unittests/test_stt.py index a1705dd3..de866fe5 100644 --- a/test/unittests/test_stt.py +++ b/test/unittests/test_stt.py @@ -91,18 +91,11 @@ def test_get_stt_config(self, get_config): class TestSTTFactory(unittest.TestCase): - def test_mappings(self): - from ovos_plugin_manager.stt import OVOSSTTFactory - self.assertIsInstance(OVOSSTTFactory.MAPPINGS, dict) - for key in OVOSSTTFactory.MAPPINGS: - self.assertIsInstance(key, str) - self.assertIsInstance(OVOSSTTFactory.MAPPINGS[key], str) - self.assertNotEqual(key, OVOSSTTFactory.MAPPINGS[key]) @patch("ovos_plugin_manager.stt.load_stt_plugin") def test_get_class(self, load_plugin): from ovos_plugin_manager.stt import OVOSSTTFactory - global_config = {"stt": {"module": "dummy"}} + global_config = {"stt": {"module": "ovos-stt-plugin-dummy"}} tts_config = {"module": "test-stt-plugin-test"} # Test load plugin mapped global config @@ -120,7 +113,7 @@ def test_create(self, get_class): get_class.return_value = plugin_class global_config = {"lang": "en-gb", - "stt": {"module": "dummy", + "stt": {"module": "ovos-stt-plugin-dummy", "ovos-stt-plugin-dummy": {"config": True, "lang": "en-ca"}}} stt_config = {"lang": "es-es", diff --git a/test/unittests/test_tts.py b/test/unittests/test_tts.py index ec3baf16..b5602921 100644 --- a/test/unittests/test_tts.py +++ b/test/unittests/test_tts.py @@ -206,18 +206,11 @@ def test_get_voices(self): class TestTTSFactory(unittest.TestCase): - def test_mappings(self): - from ovos_plugin_manager.tts import OVOSTTSFactory - self.assertIsInstance(OVOSTTSFactory.MAPPINGS, dict) - for key in OVOSTTSFactory.MAPPINGS: - self.assertIsInstance(key, str) - self.assertIsInstance(OVOSTTSFactory.MAPPINGS[key], str) - self.assertNotEqual(key, OVOSTTSFactory.MAPPINGS[key]) @patch("ovos_plugin_manager.tts.load_tts_plugin") def test_get_class(self, load_plugin): from ovos_plugin_manager.tts import OVOSTTSFactory - global_config = {"tts": {"module": "dummy"}} + global_config = {"tts": {"module": "ovos-tts-plugin-dummy"}} tts_config = {"module": "test-tts-plugin-test"} # Test load plugin mapped global config @@ -235,7 +228,7 @@ def test_create(self, get_class): get_class.return_value = plugin_class global_config = {"lang": "en-gb", - "tts": {"module": "dummy", + "tts": {"module": "ovos-tts-plugin-dummy", "ovos-tts-plugin-dummy": {"config": True, "lang": "en-ca"}}} tts_config = {"lang": "es-es",