Skip to content

Commit

Permalink
use uv pip if available
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Dec 6, 2024
1 parent 22543e8 commit 8749ead
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions ovos_core/skill_installer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import enum
import shutil
import sys
from importlib import reload
from os.path import exists
Expand All @@ -21,11 +22,11 @@ class InstallError(str, enum.Enum):
NO_PKGS = "no packages to install"


# TODO - use uv pip if available, speeds things up a lot and is the default in raspOVOS
class SkillsStore:
# default constraints to use if none are given
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 Down Expand Up @@ -82,7 +83,10 @@ def pip_install(self, packages: list,
self.play_error_sound()
return False

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 @@ -151,7 +155,10 @@ def pip_uninstall(self, packages: list,
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

0 comments on commit 8749ead

Please sign in to comment.