Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.3.0a1 #623

Merged
merged 10 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/build_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
strategy:
max-parallel: 2
matrix:
python-version: [ 3.7, 3.8, 3.9, "3.10", "3.11" ]
python-version: [3.8, 3.9, "3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
Expand All @@ -26,12 +26,11 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install Build Tools
run: |
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev libpulse-dev python3-fann2
python -m pip install build wheel
- name: Build Source Packages
run: |
python setup.py sdist
Expand All @@ -40,4 +39,4 @@ jobs:
python setup.py bdist_wheel
- name: Install package
run: |
pip install .[mycroft,lgpl,plugins,skills-essential,skills-extra,skills-audio,skills-gui,skills-internet,skills-media,skills-desktop]
uv pip install --system .[mycroft,lgpl,plugins,skills-essential,skills-extra,skills-audio,skills-gui,skills-internet,skills-media,skills-desktop]
30 changes: 15 additions & 15 deletions .github/workflows/end2end_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ jobs:
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install test dependencies
run: |
pip install -r requirements/tests.txt
pip install ./test/integrationtests/common_query/ovos_tskill_fakewiki
pip install ./test/end2end/skill-ovos-hello-world
pip install ./test/end2end/skill-ovos-fallback-unknown
pip install ./test/end2end/skill-ovos-slow-fallback
pip install ./test/end2end/skill-converse_test
pip install ./test/end2end/skill-ovos-schedule
pip install ./test/end2end/skill-new-stop
pip install ./test/end2end/skill-old-stop
pip install ./test/end2end/skill-fake-fm
pip install ./test/end2end/skill-fake-fm-legacy
pip install ./test/end2end/skill-ovos-fakewiki
pip install ./test/end2end/metadata-test-plugin
uv pip install --system -r requirements/tests.txt
uv pip install --system ./test/integrationtests/common_query/ovos_tskill_fakewiki
uv pip install --system ./test/end2end/skill-ovos-hello-world
uv pip install --system ./test/end2end/skill-ovos-fallback-unknown
uv pip install --system ./test/end2end/skill-ovos-slow-fallback
uv pip install --system ./test/end2end/skill-converse_test
uv pip install --system ./test/end2end/skill-ovos-schedule
uv pip install --system ./test/end2end/skill-new-stop
uv pip install --system ./test/end2end/skill-old-stop
uv pip install --system ./test/end2end/skill-fake-fm
uv pip install --system ./test/end2end/skill-fake-fm-legacy
uv pip install --system ./test/end2end/skill-ovos-fakewiki
uv pip install --system ./test/end2end/metadata-test-plugin
- name: Install core repo
run: |
pip install -e .[plugins]
uv pip install --system -e .[plugins]
- name: Run end2end tests
run: |
pytest --cov-append --cov=ovos_core --cov-report xml test/end2end
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ jobs:
run: |
sudo apt-get update
sudo apt install python3-dev swig
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install test dependencies
run: |
pip install -r requirements/tests.txt
pip install ./test/integrationtests/common_query/ovos_tskill_fakewiki
uv pip install --system -r requirements/tests.txt
uv pip install --system ./test/integrationtests/common_query/ovos_tskill_fakewiki
- name: Install core repo
run: |
pip install -e .[plugins]
uv pip install --system -e .[plugins]
- name: Run integration tests
run: |
pytest test/integrationtests
6 changes: 3 additions & 3 deletions .github/workflows/license_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
python-version: 3.8
- name: Install Build Tools
run: |
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev libfann-dev portaudio19-dev libpulse-dev
- name: Install core repo
run: |
pip install .[mycroft,lgpl,skills-essential]
uv pip install --system .[mycroft,lgpl,skills-essential]
- name: Get explicit and transitive dependencies
run: |
pip freeze > requirements-all.txt
uv pip freeze > requirements-all.txt
- name: Check python
id: license_check_report
uses: pilosus/[email protected]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mycroft_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ jobs:
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install test dependencies
run: |
pip install -r requirements/tests.txt
uv pip install --system -r requirements/tests.txt
- name: Install core repo
run: |
pip install -e .[mycroft,plugins,deprecated]
uv pip install --system -e .[mycroft,plugins,deprecated]
- name: Run mycroft compat tests
run: |
pytest test/backwards_compat
4 changes: 2 additions & 2 deletions .github/workflows/pipaudit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install Build Tools
run: |
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install System Dependencies
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev
- name: Install package
run: |
pip install .[skills-essential]
uv pip install --system .[skills-essential]
- uses: pypa/[email protected]
with:
# Ignore setuptools vulnerability we can't do much about
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ jobs:
run: |
sudo apt-get update
sudo apt install python3-dev swig libssl-dev portaudio19-dev libpulse-dev
python -m pip install build wheel
python -m pip install build wheel uv
- name: Install test dependencies
run: |
pip install -r requirements/tests.txt
uv pip install --system -r requirements/tests.txt
- name: Install core repo
run: |
pip install -e .[mycroft,plugins]
uv pip install --system -e .[mycroft,plugins]
- name: Run unittests
run: |
pytest --cov=ovos_core --cov-report xml test/unittests
- name: Install padatious
run: |
sudo apt install libfann-dev
pip install .[lgpl]
uv pip install --system .[lgpl]
- name: Run unittests with padatious
run: |
pytest --cov-append --cov=ovos_core --cov-report xml test/unittests
Expand Down
24 changes: 18 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# Changelog

## [0.2.18a2](https://github.com/OpenVoiceOS/ovos-core/tree/0.2.18a2) (2024-12-02)
## [0.2.21a1](https://github.com/OpenVoiceOS/ovos-core/tree/0.2.21a1) (2024-12-06)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-core/compare/0.2.18a1...0.2.18a2)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-core/compare/0.2.20a1...0.2.21a1)

**Closed issues:**

- feat: constraints files [\#596](https://github.com/OpenVoiceOS/ovos-core/issues/596)

**Merged pull requests:**

- fix: constraints.txt from url [\#617](https://github.com/OpenVoiceOS/ovos-core/pull/617) ([JarbasAl](https://github.com/JarbasAl))

## [0.2.20a1](https://github.com/OpenVoiceOS/ovos-core/tree/0.2.20a1) (2024-12-06)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-core/compare/0.2.19a1...0.2.20a1)

**Merged pull requests:**

- import basque translations [\#615](https://github.com/OpenVoiceOS/ovos-core/pull/615) ([JarbasAl](https://github.com/JarbasAl))
- fix:bracket\_expansion [\#618](https://github.com/OpenVoiceOS/ovos-core/pull/618) ([JarbasAl](https://github.com/JarbasAl))

## [0.2.18a1](https://github.com/OpenVoiceOS/ovos-core/tree/0.2.18a1) (2024-12-02)
## [0.2.19a1](https://github.com/OpenVoiceOS/ovos-core/tree/0.2.19a1) (2024-12-06)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-core/compare/0.2.17...0.2.18a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-core/compare/0.2.18...0.2.19a1)

**Merged pull requests:**

- import galician translations [\#613](https://github.com/OpenVoiceOS/ovos-core/pull/613) ([JarbasAl](https://github.com/JarbasAl))
- refactor:use uv to speedup workflows [\#619](https://github.com/OpenVoiceOS/ovos-core/pull/619) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
4 changes: 2 additions & 2 deletions ovos_core/intent_services/stop_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from ovos_config.config import Configuration
from ovos_plugin_manager.templates.pipeline import PipelineMatch, PipelinePlugin
from ovos_utils import flatten_list
from ovos_utils.bracket_expansion import expand_options
from ovos_utils.bracket_expansion import expand_template
from ovos_utils.lang import standardize_lang_tag
from ovos_utils.log import LOG
from ovos_utils.parse import match_one
Expand All @@ -33,7 +33,7 @@ def load_resource_files(self):
self._voc_cache[lang2] = {}
for f in os.listdir(f"{base}/{lang}"):
with open(f"{base}/{lang}/{f}", encoding="utf-8") as fi:
lines = [expand_options(l) for l in fi.read().split("\n")
lines = [expand_template(l) for l in fi.read().split("\n")
if l.strip() and not l.startswith("#")]
n = f.split(".", 1)[0]
self._voc_cache[lang2][n] = flatten_list(lines)
Expand Down
77 changes: 56 additions & 21 deletions ovos_core/skill_installer.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import enum
import shutil
import sys
from importlib import reload
from os.path import exists
from subprocess import Popen, PIPE
from typing import Optional

import requests
from combo_lock import NamedLock
from ovos_config.config import Configuration

import ovos_plugin_manager
from ovos_bus_client import Message
from ovos_config.config import Configuration
from ovos_utils.log import LOG


Expand All @@ -22,8 +24,9 @@ class InstallError(str, enum.Enum):

class SkillsStore:
# default constraints to use if none are given
DEFAULT_CONSTRAINTS = '/etc/mycroft/constraints.txt' # TODO XDG paths, keep backwards compat for now with msm/osm
DEFAULT_CONSTRAINTS = 'https://raw.githubusercontent.com/OpenVoiceOS/ovos-releases/refs/heads/main/constraints-stable.txt'
PIP_LOCK = NamedLock("ovos_pip.lock")
UV = shutil.which("uv") # use 'uv pip' if available, speeds things up a lot and is the default in raspOVOS

def __init__(self, bus, config=None):
self.config = config or Configuration().get("skills", {}).get("installer", {})
Expand All @@ -44,22 +47,46 @@ def play_success_sound(self):
snd = self.config.get("sounds", {}).get("pip_success", "snd/acknowledge.mp3")
self.bus.emit(Message("mycroft.audio.play_sound", {"uri": snd}))

@staticmethod
def validate_constrainsts(constraints: str):
if constraints.startswith('http'):
LOG.debug(f"Constraints url: {constraints}")
try:
response = requests.head(constraints)
if response.status_code != 200:
LOG.error(f'Remote constraints file not accessible: {response.status_code}')
return False
return True
except Exception as e:
LOG.error(f'Error accessing remote constraints: {str(e)}')
return False

# Use constraints to limit the installed versions
if not exists(constraints):
LOG.error('Couldn\'t find the constraints file')
return False

return True

def pip_install(self, packages: list,
constraints: Optional[str] = None,
print_logs: bool = True):
if not len(packages):
LOG.error("no package list provided to install")
self.play_error_sound()
return False
# Use constraints to limit the installed versions
if constraints and not exists(constraints):
LOG.error('Couldn\'t find the constraints file')

# can be set in mycroft.conf to change to testing/alpha channels
constraints = constraints or self.config.get("constraints", SkillsStore.DEFAULT_CONSTRAINTS)

if not self.validate_constrainsts(constraints):
self.play_error_sound()
return False
elif exists(SkillsStore.DEFAULT_CONSTRAINTS):
constraints = SkillsStore.DEFAULT_CONSTRAINTS

pip_args = [sys.executable, '-m', 'pip', 'install']
if self.UV is not None:
pip_args = [self.UV, 'pip', 'install']
else:
pip_args = [sys.executable, '-m', 'pip', 'install']
if constraints:
pip_args += ['-c', constraints]
if self.config.get("break_system_packages", False):
Expand Down Expand Up @@ -101,30 +128,37 @@ def pip_uninstall(self, packages: list,
self.play_error_sound()
return False

# Use constraints to limit package removal
if constraints and not exists(constraints):
LOG.error('Couldn\'t find the constraints file')
# can be set in mycroft.conf to change to testing/alpha channels
constraints = constraints or self.config.get("constraints", SkillsStore.DEFAULT_CONSTRAINTS)

if not self.validate_constrainsts(constraints):
self.play_error_sound()
return False
elif exists(SkillsStore.DEFAULT_CONSTRAINTS):
constraints = SkillsStore.DEFAULT_CONSTRAINTS

if constraints:
# get protected packages that can't be uninstalled
# by default cant uninstall any official ovos package via this bus api
if constraints.startswith("http"):
cpkgs = requests.get(constraints).text.split("\n")
elif exists(constraints):
with open(constraints) as f:
# remove version pinning and normalize _ to - (pip accepts both)
cpkgs = [p.split("~")[0].split("<")[0].split(">")[0].split("=")[0].replace("_", "-")
for p in f.read().split("\n") if p.strip()]
cpkgs = f.read().split("\n")
else:
cpkgs = ["ovos-core", "ovos-utils", "ovos-plugin-manager",
"ovos-config", "ovos-bus-client", "ovos-workshop"]

# normalize _ to - (pip accepts both)
if any(p.replace("_", "-") in cpkgs for p in packages):
# remove version pinning and normalize _ to - (pip accepts both)
cpkgs = [p.split("~")[0].split("<")[0].split(">")[0].split("=")[0].replace("_", "-")
for p in cpkgs]

if any(p in cpkgs for p in packages):
LOG.error(f'tried to uninstall a protected package: {cpkgs}')
self.play_error_sound()
return False

pip_args = [sys.executable, '-m', 'pip', 'uninstall', '-y']
if self.UV is not None:
pip_args = [self.UV, 'pip', 'uninstall']
else:
pip_args = [sys.executable, '-m', 'pip', 'uninstall', '-y']
if self.config.get("break_system_packages", False):
pip_args += ["--break-system-packages"]

Expand Down Expand Up @@ -152,7 +186,8 @@ def pip_uninstall(self, packages: list,
self.play_success_sound()
return True

def validate_skill(self, url):
@staticmethod
def validate_skill(url):
if not url.startswith("https://github.com/"):
return False
# TODO - check if setup.py
Expand Down
6 changes: 3 additions & 3 deletions ovos_core/version.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 2
VERSION_BUILD = 18
VERSION_ALPHA = 0
VERSION_MINOR = 3
VERSION_BUILD = 0
VERSION_ALPHA = 1
# END_VERSION_BLOCK

# for compat with old imports
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ combo-lock>=0.2.2, <0.4

padacioso>=1.0.0, <2.0.0
ovos-adapt-parser>=1.0.5, <2.0.0
ovos_ocp_pipeline_plugin>=1.0.7, <2.0.0
ovos_ocp_pipeline_plugin==1.0.7
ovos-common-query-pipeline-plugin>=1.0.5, <2.0.0

ovos-utils>=0.3.5,<1.0.0
ovos-utils[extras]>=0.6.0,<1.0.0
ovos_bus_client>=0.1.4,<2.0.0
ovos-plugin-manager>=0.5.6,<1.0.0
ovos-config>=0.0.13,<2.0.0
Expand Down
Loading