From 8d17328cfecb8ee08da85151a46c0c3cf267b7a9 Mon Sep 17 00:00:00 2001 From: Daniel McKnight <34697904+NeonDaniel@users.noreply.github.com> Date: Thu, 6 Feb 2025 17:22:49 -0800 Subject: [PATCH] Update CLI configuration handling and unit tests (#178) # Description Update cli module to set default envvars Remove references to deprecated `init_config_dir` function Update Python versions used in unit tests Update license notices for 2025 Patch `lang` handling for backwards-compat. # Issues # Other Notes --- .github/workflows/license_tests.yml | 4 +--- .github/workflows/unit_tests.yml | 6 +++--- LICENSE.md | 2 +- docker_overlay/root/run.sh | 2 +- neon_audio/__init__.py | 2 +- neon_audio/__main__.py | 2 +- neon_audio/cli.py | 10 ++++++---- neon_audio/service.py | 2 +- neon_audio/tts/__init__.py | 2 +- neon_audio/tts/neon.py | 10 +++++++--- neon_audio/utils.py | 2 +- requirements/requirements.txt | 2 +- setup.py | 2 +- tests/__init__.py | 2 +- tests/api_method_tests.py | 2 +- tests/test_objects/__init__.py | 2 +- tests/unit_tests.py | 7 +++---- version.py | 2 +- 18 files changed, 33 insertions(+), 30 deletions(-) diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index dd114f0..dcf543d 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -7,6 +7,4 @@ on: - master jobs: license_tests: - uses: neongeckocom/.github/.github/workflows/license_tests.yml@master - with: - packages-exclude: '^(precise-runner|fann2|tqdm|bs4|ovos-phal-plugin|ovos-ocp|bitstruct|audioread).*' \ No newline at end of file + uses: neongeckocom/.github/.github/workflows/license_tests.yml@master \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index ab7464c..ee795ef 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -18,12 +18,12 @@ jobs: timeout-minutes: 15 strategy: matrix: - python-version: [3.7, 3.8, 3.9, '3.10'] + python-version: [3.9, '3.10', '3.11'] runs-on: ubuntu-latest 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 dependencies diff --git a/LICENSE.md b/LICENSE.md index 0f84944..cbec999 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Development System # All trademark and other rights reserved by their respective owners -# Copyright 2008-2021 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # BSD-3 License Redistribution and use in source and binary forms, with or without modification, are permitted provided that the diff --git a/docker_overlay/root/run.sh b/docker_overlay/root/run.sh index 873eae0..4be28c5 100644 --- a/docker_overlay/root/run.sh +++ b/docker_overlay/root/run.sh @@ -1,7 +1,7 @@ #!/bin/bash # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/neon_audio/__init__.py b/neon_audio/__init__.py index 718d1b0..5694901 100644 --- a/neon_audio/__init__.py +++ b/neon_audio/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/neon_audio/__main__.py b/neon_audio/__main__.py index f9e67f5..57b959c 100644 --- a/neon_audio/__main__.py +++ b/neon_audio/__main__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/neon_audio/cli.py b/neon_audio/cli.py index 9c5931a..6e7aee0 100644 --- a/neon_audio/cli.py +++ b/neon_audio/cli.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License @@ -28,14 +28,17 @@ import click import sys -from typing import List +from os import environ +from typing import List from click_default_group import DefaultGroup from neon_utils.packaging_utils import get_package_version_spec -from neon_utils.configuration_utils import init_config_dir from ovos_config.config import Configuration from ovos_utils.log import LOG, log_deprecation +environ.setdefault("OVOS_CONFIG_BASE_FOLDER", "neon") +environ.setdefault("OVOS_CONFIG_FILENAME", "neon.yaml") + @click.group("neon-audio", cls=DefaultGroup, no_args_is_help=True, invoke_without_command=True, @@ -56,7 +59,6 @@ def neon_audio_cli(version: bool = False): @click.option("--force-install", "-f", default=False, is_flag=True, help="Force pip installation of configured module") def run(module, package, force_install): - init_config_dir() from neon_audio.__main__ import main if force_install or module or package: install_plugin(module, package, force_install) diff --git a/neon_audio/service.py b/neon_audio/service.py index 4458dbe..027f559 100644 --- a/neon_audio/service.py +++ b/neon_audio/service.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/neon_audio/tts/__init__.py b/neon_audio/tts/__init__.py index 3ae24f0..e816585 100644 --- a/neon_audio/tts/__init__.py +++ b/neon_audio/tts/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/neon_audio/tts/neon.py b/neon_audio/tts/neon.py index f51cb32..9be5834 100644 --- a/neon_audio/tts/neon.py +++ b/neon_audio/tts/neon.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License @@ -210,6 +210,7 @@ def __new__(cls, base_engine, *args, **kwargs): # TODO: Below method is only to bridge compatibility base_engine._get_tts = cls._get_tts base_engine._init_playback = cls._init_playback + base_engine.lang = cls.lang return cls._init_neon(base_engine, *args, **kwargs) @staticmethod @@ -223,8 +224,6 @@ def _init_neon(base_engine, *args, **kwargs): base_engine.keys = {} base_engine.language_config = language_config - base_engine.lang = base_engine.lang or language_config.get("user", - "en-us") try: if language_config.get('detection_module'): # Prevent loading a detector if not configured @@ -247,6 +246,11 @@ def _init_neon(base_engine, *args, **kwargs): return base_engine + @property + def lang(self): + # Patch breaking change in OVOS that normalizes en-US instead of en-us + return TTS.lang.fget(self).lower() + def _init_playback(self, playback_thread: NeonPlaybackThread = None): # shutdown any previous thread if TTS.playback: diff --git a/neon_audio/utils.py b/neon_audio/utils.py index c864432..6274077 100644 --- a/neon_audio/utils.py +++ b/neon_audio/utils.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 413b0ae..9d0fcfa 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -3,7 +3,7 @@ ovos-utils~=0.0,>=0.0.35 ovos-config~=0.0,>=0.0.10 phoneme-guesser~=0.1 ovos-plugin-manager~=0.0,>=0.0.26a16 -neon-utils[network]~=1.9 +neon-utils[network,sentry,signal]~=1.9,>=1.12.1a2 click~=8.0 click-default-group~=1.2 ovos-bus-client~=0.0,>=0.0.3 diff --git a/setup.py b/setup.py index b23d570..4921ac5 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/tests/__init__.py b/tests/__init__.py index 718d1b0..5694901 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/tests/api_method_tests.py b/tests/api_method_tests.py index 00bb52c..ddf1025 100644 --- a/tests/api_method_tests.py +++ b/tests/api_method_tests.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/tests/test_objects/__init__.py b/tests/test_objects/__init__.py index d537f3c..0cfd81b 100644 --- a/tests/test_objects/__init__.py +++ b/tests/test_objects/__init__.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License diff --git a/tests/unit_tests.py b/tests/unit_tests.py index 9a168fd..f63dbef 100644 --- a/tests/unit_tests.py +++ b/tests/unit_tests.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License @@ -196,6 +196,7 @@ def test_install_tts_plugin(self): self.assertTrue(install_tts_plugin("neon-tts-plugin-coqui")) self.assertFalse(install_tts_plugin("neon-tts-plugin-invalid")) + @skip("Configuration patching is deprecated") def test_patch_config(self): import json from neon_audio.utils import use_neon_audio @@ -229,12 +230,10 @@ def test_patch_config(self): class TestCLI(unittest.TestCase): runner = CliRunner() - @patch("neon_audio.cli.init_config_dir") @patch("neon_audio.__main__.main") - def test_run(self, main, init_config): + def test_run(self, main): from neon_audio.cli import run self.runner.invoke(run) - init_config.assert_called_once() main.assert_called_once() diff --git a/version.py b/version.py index 697c276..99f694f 100644 --- a/version.py +++ b/version.py @@ -1,6 +1,6 @@ # NEON AI (TM) SOFTWARE, Software Development Kit & Application Framework # All trademark and other rights reserved by their respective owners -# Copyright 2008-2022 Neongecko.com Inc. +# Copyright 2008-2025 Neongecko.com Inc. # Contributors: Daniel McKnight, Guy Daniels, Elon Gasper, Richard Leeds, # Regina Bloomstine, Casimiro Ferreira, Andrii Pernatii, Kirill Hrymailo # BSD-3 License