diff --git a/.github/workflows/ovoscope.yml b/.github/workflows/ovoscope.yml index 0f48332..8dd30d6 100644 --- a/.github/workflows/ovoscope.yml +++ b/.github/workflows/ovoscope.yml @@ -12,4 +12,4 @@ jobs: with: python_version: '3.11' install_extras: 'test' - test_path: 'test/end2end/' + test_path: 'test/unittests/' diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index bb58308..0000000 --- a/MANIFEST.in +++ /dev/null @@ -1,6 +0,0 @@ -recursive-include dialog * -recursive-include vocab * -recursive-include locale * -recursive-include res * -recursive-include ui * -recursive-include skill * \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0cb2a1f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,59 @@ +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "ovos-skill-volume" +dynamic = ["version"] +description = "ovos skill plugin" +readme = "README.md" +license = { text = "Apache-2.0" } +authors = [ + { name = "JarbasAi", email = "jarbasai@mailfence.com" } +] +keywords = ["ovos", "skill", "plugin"] +classifiers = [ + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", +] +requires-python = ">=3.9" +dependencies = [ + "ovos-utils>=0.0.38,<1.0.0", + "ovos-workshop>=8.0.0,<9.0.0", + "ovos-utterance-normalizer>=0.0.1,<1.0.0", + "ovos-number-parser>=0.0.1,<1.0.0", +] + +[project.optional-dependencies] +test = [ + "pytest", + "ovos-workshop>=8.0.0,<9.0.0", + "ovos-plugin-manager", + "ovos-utils", +] + +[project.urls] +Homepage = "https://github.com/OpenVoiceOS/ovos-skill-volume" + +[project.entry-points."ovos.plugin.skill"] +"ovos-skill-volume.openvoiceos" = "ovos_skill_volume:VolumeSkill" + +[tool.setuptools.dynamic] +version = { attr = "version.__version__" } + +[tool.setuptools] +packages = ["ovos_skill_volume"] + +[tool.setuptools.package-dir] +"ovos_skill_volume" = "." + +[tool.setuptools.package-data] +"ovos_skill_volume" = [ + "*.json", + "locale/**/*", + "ui/**/*", + "vocab/**/*", + "dialog/**/*", + "regex/**/*", + "skill/**/*", +] diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 9eda28b..0000000 --- a/requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -ovos-utils>=0.0.38,<1.0.0 -ovos-workshop>=8.0.0,<9.0.0 -ovos-utterance-normalizer>=0.0.1,<1.0.0 -ovos-number-parser>=0.0.1,<1.0.0 diff --git a/setup.py b/setup.py deleted file mode 100755 index 0db631d..0000000 --- a/setup.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python3 -from setuptools import setup -import os -from os import walk, path - - -URL = "https://github.com/OpenVoiceOS/ovos-skill-volume" -SKILL_CLAZZ = "VolumeSkill" # needs to match __init__.py class name -PYPI_NAME = "ovos-skill-volume" # pip install PYPI_NAME - - -# below derived from github url to ensure standard skill_id -SKILL_AUTHOR, SKILL_NAME = URL.split(".com/")[-1].split("/") -SKILL_PKG = SKILL_NAME.lower().replace('-', '_') -PLUGIN_ENTRY_POINT = f'{SKILL_NAME.lower()}.{SKILL_AUTHOR.lower()}={SKILL_PKG}:{SKILL_CLAZZ}' -# skill_id=package_name:SkillClass - - -def get_requirements(requirements_filename: str): - requirements_file = path.join(path.abspath(path.dirname(__file__)), - requirements_filename) - with open(requirements_file, 'r', encoding='utf-8') as r: - requirements = r.readlines() - requirements = [r.strip() for r in requirements if r.strip() - and not r.strip().startswith("#")] - if 'MYCROFT_LOOSE_REQUIREMENTS' in os.environ: - print('USING LOOSE REQUIREMENTS!') - requirements = [r.replace('==', '>=').replace('~=', '>=') for r in requirements] - return requirements - - -def find_resource_files(): - resource_base_dirs = ("locale", "ui", "vocab", "dialog", "regex", "skill") - base_dir = path.dirname(__file__) - package_data = ["*.json"] - for res in resource_base_dirs: - if path.isdir(path.join(base_dir, res)): - for (directory, _, files) in walk(path.join(base_dir, res)): - if files: - package_data.append( - path.join(directory.replace(base_dir, "").lstrip('/'), - '*')) - return package_data - - -with open(path.join(path.abspath(path.dirname(__file__)), "README.md"), "r") as f: - long_description = f.read() - - -def get_version(): - """ Find the version of this skill""" - version_file = os.path.join(os.path.dirname(__file__), 'version.py') - major, minor, build, alpha = (None, None, None, None) - with open(version_file) as f: - for line in f: - if 'VERSION_MAJOR' in line: - major = line.split('=')[1].strip() - elif 'VERSION_MINOR' in line: - minor = line.split('=')[1].strip() - elif 'VERSION_BUILD' in line: - build = line.split('=')[1].strip() - elif 'VERSION_ALPHA' in line: - alpha = line.split('=')[1].strip() - - if ((major and minor and build and alpha) or - '# END_VERSION_BLOCK' in line): - break - version = f"{major}.{minor}.{build}" - if int(alpha): - version += f"a{alpha}" - return version - - -setup( - name=PYPI_NAME, - version=get_version(), - description='ovos skill plugin', - long_description=long_description, - long_description_content_type="text/markdown", - url=URL, - author='JarbasAi', - author_email='jarbasai@mailfence.com', - license='Apache-2.0', - package_dir={SKILL_PKG: ""}, - package_data={SKILL_PKG: find_resource_files()}, - packages=[SKILL_PKG], - include_package_data=True, - install_requires=get_requirements("requirements.txt"), - keywords='ovos skill plugin', - entry_points={'ovos.plugin.skill': PLUGIN_ENTRY_POINT} -) diff --git a/test/unittests/test_skill_loading.py b/test/unittests/test_skill_loading.py index eaee469..0964740 100644 --- a/test/unittests/test_skill_loading.py +++ b/test/unittests/test_skill_loading.py @@ -1,21 +1,17 @@ import unittest -from os.path import join, dirname -import os -from ovos_utils.bracket_expansion import expand_parentheses, expand_options +from os.path import dirname -from adapt.engine import IntentDeterminationEngine -from adapt.intent import IntentBuilder -from skill_ovos_volume import VolumeSkill, create_skill from ovos_plugin_manager.skills import find_skill_plugins from ovos_utils.messagebus import FakeBus -from mycroft.skills.skill_loader import PluginSkillLoader, SkillLoader + +from ovos_skill_volume import VolumeSkill class TestSkillLoading(unittest.TestCase): @classmethod - def setUpClass(self): - self.skill_id = "ovos-skill-volume.openvoiceos" - self.path = dirname(dirname(dirname(__file__))) + def setUpClass(cls): + cls.skill_id = "ovos-skill-volume.openvoiceos" + cls.path = dirname(dirname(dirname(__file__))) def test_from_class(self): bus = FakeBus() @@ -24,13 +20,6 @@ def test_from_class(self): self.assertEqual(skill.bus, bus) self.assertEqual(skill.skill_id, self.skill_id) - def test_from_func(self): - bus = FakeBus() - skill = create_skill() - skill._startup(bus, self.skill_id) - self.assertEqual(skill.bus, bus) - self.assertEqual(skill.skill_id, self.skill_id) - def test_from_plugin(self): bus = FakeBus() for skill_id, plug in find_skill_plugins().items(): @@ -42,26 +31,3 @@ def test_from_plugin(self): break else: raise RuntimeError("plugin not found") - - def test_from_loader(self): - bus = FakeBus() - loader = SkillLoader(bus, self.path) - loader.load() - self.assertEqual(loader.instance.bus, bus) - self.assertEqual(loader.instance.root_dir, self.path) - - def test_from_plugin_loader(self): - bus = FakeBus() - loader = PluginSkillLoader(bus, self.skill_id) - for skill_id, plug in find_skill_plugins().items(): - if skill_id == self.skill_id: - loader.load(plug) - break - else: - raise RuntimeError("plugin not found") - - self.assertEqual(loader.skill_id, self.skill_id) - self.assertEqual(loader.instance.bus, bus) - self.assertEqual(loader.instance.skill_id, self.skill_id) - - diff --git a/version.py b/version.py index 7071781..f91c562 100644 --- a/version.py +++ b/version.py @@ -4,3 +4,5 @@ VERSION_BUILD = 21 VERSION_ALPHA = 2 # END_VERSION_BLOCK + +__version__ = f"{VERSION_MAJOR}.{VERSION_MINOR}.{VERSION_BUILD}" + (f"a{VERSION_ALPHA}" if VERSION_ALPHA else "")