From 5b98993b13dafe9a85495e4c68ad9b42863ef2bf Mon Sep 17 00:00:00 2001 From: historia Date: Thu, 27 Aug 2026 00:04:16 -0400 Subject: feat: separate venvs for qwen-tts and faster, manage (un)installs --- app/backends/common.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'app/backends/common.py') diff --git a/app/backends/common.py b/app/backends/common.py index b9448e0..098dfb2 100644 --- a/app/backends/common.py +++ b/app/backends/common.py @@ -496,22 +496,27 @@ def git_clone(url: str, target: Path, *, emit=None, cancel=None) -> int: emit=emit, cancel=cancel) -def pip_install(packages: List[str], *, emit=None, cancel=None) -> int: - """pip install PACKAGES into the managed venv (``envs/tts``). Returns exit code. +def pip_install(packages: List[str], *, emit=None, cancel=None, + env_dir: Optional[Path] = None) -> int: + """pip install PACKAGES into a managed venv. Returns exit code. Delegates to ``backends.envs.pip_install`` so backend TTS packages are - installed alongside the app requirements in the tool-managed environment - rather than into whatever interpreter happens to be running the wizard. - With EMIT given (the in-TUI task view) pip runs with its output streamed - into EMIT; CANCEL aborts it. The import is local to avoid a circular - import (envs imports this module). + installed into their dedicated tool-managed environments (``envs/tts`` + default; ``envs/qwen`` / ``envs/faster`` via ENV_DIR) rather than into + whatever interpreter happens to be running the wizard — and never two + conflicting stacks into the same env. With EMIT given (the in-TUI task + view) pip runs with its output streamed into EMIT; CANCEL aborts it. + The import is local to avoid a circular import (envs imports this + module). """ from backends import envs - return envs.pip_install(packages, emit=emit, cancel=cancel) + return envs.pip_install(packages, emit=emit, cancel=cancel, + env_dir=env_dir) -def pip_uninstall(packages: List[str], *, emit=None) -> int: - """pip uninstall PACKAGES from the managed venv. Returns exit code. +def pip_uninstall(packages: List[str], *, emit=None, + env_dir: Optional[Path] = None) -> int: + """pip uninstall PACKAGES from a managed venv. Returns exit code. Delegates to ``backends.envs.pip_uninstall`` (local import to avoid a circular import). Used by the backends' ``uninstall`` action. With EMIT @@ -519,4 +524,4 @@ def pip_uninstall(packages: List[str], *, emit=None) -> int: its output never touches the terminal behind curses. """ from backends import envs - return envs.pip_uninstall(packages, emit=emit) + return envs.pip_uninstall(packages, emit=emit, env_dir=env_dir) -- cgit v1.2.3