aboutsummaryrefslogtreecommitdiff
path: root/app/backends/common.py
diff options
context:
space:
mode:
authorhistoria <historiavg@proton.me>2026-08-27 00:04:16 -0400
committerhistoria <historiavg@proton.me>2026-08-27 00:04:16 -0400
commit5b98993b13dafe9a85495e4c68ad9b42863ef2bf (patch)
tree57db1566deb5351ec6bfb8c70de4126bbc5fc2da /app/backends/common.py
parentf18f421d9180ae0e3bff9496b1fdaf53d3624a75 (diff)
downloadtts-audiobook-generator-5b98993b13dafe9a85495e4c68ad9b42863ef2bf.tar.gz
feat: separate venvs for qwen-tts and faster, manage (un)installs
Diffstat (limited to 'app/backends/common.py')
-rw-r--r--app/backends/common.py27
1 files changed, 16 insertions, 11 deletions
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)