From 0c1632f812e0f6acdf24bf1929bbf0cb87f68921 Mon Sep 17 00:00:00 2001 From: JarbasAI <33701864+JarbasAl@users.noreply.github.com> Date: Fri, 7 Apr 2023 00:11:33 +0100 Subject: [PATCH] feat/bump_ovos_precise_runner (#4) --- .github/workflows/build_tests.yml | 16 +++++--- .github/workflows/build_tests_full.yml | 52 ++++++++++++++++++++++++++ .github/workflows/license_tests.yml | 33 ++++++++++------ .github/workflows/unit_tests.yml | 12 ++---- .gitignore | 33 ++++++++++++++++ README.md | 5 ++- requirements/requirements.txt | 2 +- setup.py | 6 ++- test/license_tests.py | 52 -------------------------- 9 files changed, 130 insertions(+), 81 deletions(-) create mode 100644 .github/workflows/build_tests_full.yml create mode 100644 .gitignore delete mode 100644 test/license_tests.py diff --git a/.github/workflows/build_tests.yml b/.github/workflows/build_tests.yml index 0d7bd7f..874a523 100644 --- a/.github/workflows/build_tests.yml +++ b/.github/workflows/build_tests.yml @@ -1,4 +1,4 @@ -name: Run Build Tests +name: Run tflite Build Tests on: push: branches: @@ -20,16 +20,20 @@ on: workflow_dispatch: jobs: - build_tests: + lite_build_tests: + strategy: + max-parallel: 2 + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: ref: ${{ github.head_ref }} - name: Setup Python - uses: actions/setup-python@v1 + uses: actions/setup-python@v2 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Install Build Tools run: | python -m pip install build wheel @@ -43,6 +47,6 @@ jobs: - name: Build Distribution Packages run: | python setup.py bdist_wheel - - name: Install package + - name: Install lite package run: | - pip install . + pip install .[tflite] \ No newline at end of file diff --git a/.github/workflows/build_tests_full.yml b/.github/workflows/build_tests_full.yml new file mode 100644 index 0000000..b78d15e --- /dev/null +++ b/.github/workflows/build_tests_full.yml @@ -0,0 +1,52 @@ +name: Run tensorflow Build Tests +on: + push: + branches: + - master + pull_request: + branches: + - dev + paths-ignore: + - 'replace_package_name/version.py' + - 'test/**' + - 'examples/**' + - '.github/**' + - '.gitignore' + - 'LICENSE' + - 'CHANGELOG.md' + - 'MANIFEST.in' + - 'readme.md' + - 'scripts/**' + workflow_dispatch: + +jobs: + full_build_tests: + strategy: + max-parallel: 2 + matrix: + python-version: [ 3.7, 3.8, 3.9, "3.10" ] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.head_ref }} + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Build Tools + run: | + python -m pip install build wheel + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt install python3-dev swig portaudio19-dev + - name: Build Source Packages + run: | + python setup.py sdist + - name: Build Distribution Packages + run: | + python setup.py bdist_wheel + - name: Install package + run: | + pip install .[full] \ No newline at end of file diff --git a/.github/workflows/license_tests.yml b/.github/workflows/license_tests.yml index 7118f31..273e41b 100644 --- a/.github/workflows/license_tests.yml +++ b/.github/workflows/license_tests.yml @@ -1,6 +1,11 @@ name: Run License Tests on: push: + branches: + - master + pull_request: + branches: + - dev workflow_dispatch: jobs: @@ -8,8 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - with: - ref: ${{ github.head_ref }} - name: Setup Python uses: actions/setup-python@v1 with: @@ -20,16 +23,22 @@ jobs: - name: Install System Dependencies run: | sudo apt-get update - sudo apt install python3-dev swig portaudio19-dev + sudo apt install python3-dev swig libssl-dev portaudio19-dev - name: Install core repo run: | - pip install . - - name: Install licheck - run: | - pip install git+https://github.com/NeonJarbas/lichecker - - name: Install test dependencies + pip install .[tflite] + - name: Get explicit and transitive dependencies run: | - pip install pytest pytest-timeout pytest-cov - - name: Test Licenses - run: | - pytest test/license_tests.py \ No newline at end of file + pip freeze > requirements-all.txt + - name: Check python + id: license_check_report + uses: pilosus/action-pip-license-checker@v0.5.0 + with: + requirements: 'requirements-all.txt' + fail: 'Copyleft,Other,Error' + fails-only: true + exclude: '^(tqdm).*' + exclude-license: '^(Mozilla).*$' + - name: Print report + if: ${{ always() }} + run: echo "${{ steps.license_check_report.outputs.report }}" \ No newline at end of file diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index b384d8a..3344c11 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -32,25 +32,21 @@ on: jobs: unit_tests: - strategy: - max-parallel: 2 - matrix: - python-version: [ 3.7, 3.8, 3.9, "3.10" ] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Set up python ${{ matrix.python-version }} + - name: Set up python uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: 3.8 - name: Install System Dependencies run: | sudo apt-get update - sudo apt install python3-dev + sudo apt install python3-dev swig portaudio19-dev python -m pip install build wheel - name: Install core repo run: | - pip install . + pip install .[tflite] - name: Install test dependencies run: | pip install pytest pytest-timeout pytest-cov diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3155be6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,33 @@ +dev.env +.dev_opts.json +.idea +*.code-workspace +*.pyc +*.swp +*~ +mimic +/skills +pocketsphinx-python +*.egg-info/ +build +dist +tornado.web +tornado.ioloop +mycroft/__version__.py +scripts/logs/* +logs/* +.coverage +/htmlcov +test/audio_accuracy/data +scripts/*.screen +doc/_build/ +.installed +.mypy_cache +.vscode +.theia +.venv/ + +# Created by unit tests +test/unittests/skills/test_skill/settings.json +test_conf.json +.pytest_cache/ diff --git a/README.md b/README.md index cf5bae2..87d4a7c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,10 @@ Mycroft wake word plugin for [precise-lite](https://github.com/OpenVoiceOS/preci ## Install -`pip install ovos-ww-plugin-precise-lite` +This package supports both tflite-runner and the full tensorflow. + +To install with tflite, use `pip install ovos-ww-plugin-precise-lite[tflite]`. +For the full tensorflow use `pip install ovos-ww-plugin-precise-lite[full]`. ## Configuration diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 450786a..86526be 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,3 +1,3 @@ -precise_lite_runner~=0.4 +precise_lite_runner~=0.4, >=0.4.1 ovos-plugin-manager>=0.0.4 ovos-utils>=0.0.14 \ No newline at end of file diff --git a/setup.py b/setup.py index 3e19478..3dcc213 100755 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -from setuptools import setup import os + from setuptools import setup BASEDIR = os.path.abspath(os.path.dirname(__file__)) @@ -65,6 +65,10 @@ def required(requirements_file): license='Apache-2.0', packages=['ovos_ww_plugin_precise_lite'], install_requires=required("requirements/requirements.txt"), + extras_require={ + 'tflite': ["tflite-runtime"], + 'full': ["tensorflow"] + }, zip_safe=True, classifiers=[ 'Development Status :: 3 - Alpha', diff --git a/test/license_tests.py b/test/license_tests.py deleted file mode 100644 index 5b1b6fd..0000000 --- a/test/license_tests.py +++ /dev/null @@ -1,52 +0,0 @@ -import unittest -from pprint import pprint - -from lichecker import LicenseChecker - -# these packages dont define license in setup.py -# manually verified and injected -license_overrides = { - 'ptyprocess': 'ISC', - "kthread": "MIT", - "sonopy": "Apache-2.0", - "pyaudio": "MIT" -} -# explicitly allow these packages that would fail otherwise -whitelist = [] - -# validation flags -allow_nonfree = False -allow_viral = False -allow_unknown = False -allow_unlicense = True -allow_ambiguous = False - -pkg_name = "ovos-ww-plugin-precise-lite" - - -class TestLicensing(unittest.TestCase): - @classmethod - def setUpClass(self): - licheck = LicenseChecker(pkg_name, - license_overrides=license_overrides, - whitelisted_packages=whitelist, - allow_ambiguous=allow_ambiguous, - allow_unlicense=allow_unlicense, - allow_unknown=allow_unknown, - allow_viral=allow_viral, - allow_nonfree=allow_nonfree) - print("Package", pkg_name) - print("Version", licheck.version) - print("License", licheck.license) - print("Transient Requirements (dependencies of dependencies)") - pprint(licheck.transient_dependencies) - self.licheck = licheck - - def test_license_compliance(self): - print("Package Versions") - pprint(self.licheck.versions) - - print("Dependency Licenses") - pprint(self.licheck.licenses) - - self.licheck.validate()