From c02d66b2d3221c0c5f5e8f2cb2ae218f1e325a0a Mon Sep 17 00:00:00 2001 From: historia Date: Mon, 24 Aug 2026 01:57:13 -0400 Subject: feat: manage venv for all backends --- audiobook.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'audiobook.py') diff --git a/audiobook.py b/audiobook.py index 174d8b4..792b274 100755 --- a/audiobook.py +++ b/audiobook.py @@ -20,6 +20,13 @@ if sys.platform == "win32": except AttributeError: pass +# The managed-environment bootstrap (backends.envs) is stdlib-only and is +# imported here so main() can launch it before any third-party dependency is +# touched. It must NOT run at import time (importing this module must stay +# light so the TUI hub and the tests can import it from any environment); it +# runs only when audiobook.py is executed as a script, from main() below. +from backends import envs as _envs # noqa: I001 + from converter import config from converter.converter import ( AUDIO_FORMATS, @@ -100,6 +107,10 @@ def convert(backend: str = None, voice: str = None, clone: str = None, def main() -> None: """Entry point: TUI hub with no args in a terminal, else argparse CLI.""" + # Run inside the managed venv (envs/tts), creating it (and installing + # requirements.txt) first if needed. A no-op when already there. Done + # here rather than at import time so importing this module is light. + _envs.bootstrap(__file__) # No arguments + interactive terminal -> the TUI hub (set up backends # and process the input directory end-to-end). Anything else is the # scriptable argparse CLI. -- cgit v1.2.3