MCPcopy Create free account
hub / github.com/unslothai/unsloth / _build_uv_cmd

Function _build_uv_cmd

studio/install_python_stack.py:1848–1864  ·  view source on GitHub ↗

Build a uv pip install command with translated flags.

(args: tuple[str, ...])

Source from the content-addressed store, hash-verified

1846
1847
1848def _build_uv_cmd(args: tuple[str, ...]) -> list[str]:
1849 """Build a uv pip install command with translated flags."""
1850 cmd = ["uv", "pip", "install"]
1851 if UV_NEEDS_SYSTEM:
1852 cmd.append("--system")
1853 # Always pass --python so uv targets the right environment. Without it, uv
1854 # can ignore an activated venv and install into the system Python (seen on
1855 # Colab and similar).
1856 cmd.extend(["--python", sys.executable])
1857 cmd.extend(_translate_pip_args_for_uv(args))
1858 # Torch is pre-installed by install.sh/setup.ps1. Do not add
1859 # --torch-backend by default -- it can cause solver dead-ends on CPU-only
1860 # machines. Callers that need it can set UV_TORCH_BACKEND.
1861 _tb = os.environ.get("UV_TORCH_BACKEND", "")
1862 if _tb:
1863 cmd.append(f"--torch-backend={_tb}")
1864 return cmd
1865
1866
1867def pip_install_try(

Callers 2

pip_install_tryFunction · 0.85
pip_installFunction · 0.85

Calls 2

getMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…