Skip to content

Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.

Shorten Windows uv source build paths

Bowen Xue5f15a4e8ccab
diff --git a/freevideo_engine/bootstrap.py b/freevideo_engine/bootstrap.py
index e16cc7c..dd80e61 100644
--- a/freevideo_engine/bootstrap.py
+++ b/freevideo_engine/bootstrap.py
@@ -31,7 +31,7 @@ from .install_tuning import build_parallelism, required_models, cache_compatible
from .terminal_ui import TerminalUI, LogProgress
from .locking import runtime_lock, LOCK_ENV
from .environments import (ENVIRONMENTS, environment_names, select_layout, role_pythons, constraints_file,
- bootstrap_versions, uv_file_arguments)
+ bootstrap_versions, uv_file_arguments, uv_build_environment)
from . import disk_space
from . import network
from . import processes
@@ -1390,6 +1390,7 @@ class Installer:
env = temporary_environment(self.root, env or self.env)
env = dict(env, FREEVIDEO_INSTALL_PROGRESS='1')
args, cwd = uv_file_arguments(args, cwd)
+ env = uv_build_environment(args, self.root, env)
with self.state_lock:
index = len(self.state['steps'])
log = self.run_dir / ('%02d-%s.log' % (index, label))
diff --git a/freevideo_engine/environments.py b/freevideo_engine/environments.py
index 6fdb6a3..276df74 100644
--- a/freevideo_engine/environments.py
+++ b/freevideo_engine/environments.py
@@ -1,4 +1,5 @@
"""Pinned installation layouts; model lifetimes are independent of venv count."""
+import logging
import os
from pathlib import Path
import platform
@@ -28,6 +29,59 @@ UV_FILE_LIST_OPTIONS = frozenset(('-c', '--constraint', '--constraints', '-b', '
'--build-constraints', '--override', '--overrides'))
+# uv 0.9.0 adds sdists-v9/<index>/<name>/<version>/<revision>/src and
+# setuptools adds build/bdist.<platform>/wheel/... beneath the cache. Reserve
+# 200 characters below the engine root, including downloads/uv-cache. This
+# allows headroom above measured staging paths, not arbitrary sdists.
+UV_BUILD_PATH_CHARS = 200
+
+
+def uv_build_environment(command, root, environ):
+ """Windows uv pip builds use a short view of the existing cache and scratch.
+
+ TEMP alone does not move uv's sdist source tree or isolated build venv.
+ Mark only this child's view: processes.popen translates its paths, while
+ installation settings, cache ownership and the parent's environment stay put.
+ """
+ if (not command or Path(command[0]).name.lower() not in ('uv', 'uv.exe')
+ or list(command[1:2]) != ['pip']):
+ return environ
+ from . import launch_view, runtime_alias
+ from .long_paths import io_path, path_chars, plain
+ from .package_paths import WINDOWS_PATH_LIMIT
+ from .triton_compat import TEMP_KEYS, TEMP_ROOT_ENV, _writable_temporary
+ if not runtime_alias._backend.windows():
+ return environ
+ root = Path(os.path.abspath(plain(root)))
+ view = launch_view.current(environ)
+ if (view is None or not root.is_relative_to(view.real)
+ or path_chars(launch_view.value(root, view)) + 1 + UV_BUILD_PATH_CHARS > WINDOWS_PATH_LIMIT):
+ try:
+ view = launch_view.View(root, runtime_alias.runtime_view(root, longest=UV_BUILD_PATH_CHARS))
+ except OSError as error:
+ if (path_chars(root) + 1 + UV_BUILD_PATH_CHARS <= WINDOWS_PATH_LIMIT
+ and runtime_alias._backend.ansi_path(root)):
+ view = launch_view.View(root, root)
+ else:
+ return environ # No short entry: keep the old behaviour; packages without source builds still install.
+ if path_chars(launch_view.value(root, view)) + 1 + UV_BUILD_PATH_CHARS > WINDOWS_PATH_LIMIT:
+ return environ
+ temporary = Path(launch_view.value(root / 'tmp' / 'uv', view))
+ try:
+ for path in (temporary.parent, temporary):
+ folder = io_path(path)
+ folder.mkdir(parents=True, exist_ok=True)
+ if folder.is_symlink() or runtime_alias.is_junction(path):
+ raise OSError('The package build temporary folder is a link')
+ _writable_temporary(temporary)
+ except OSError as error:
+ # Like a missing short entry, an unusable scratch folder must not stop installs that worked before.
+ logging.getLogger(__name__).warning('Package builds keep the previous environment: %s', error)
+ return environ
+ return dict(launch_view.environment_view(environ, view),
+ **{key: str(temporary) for key in (*TEMP_KEYS, TEMP_ROOT_ENV)})
+
+
def uv_file_arguments(command, cwd=None):
"""Return (command, cwd) for which uv reads constraint files in folders with spaces.