uv has first-class support for automatically navigating the matrix of pytorch indexes/builds/gpu variants etc when using uv pip based on the UV_TORCH_BACKEND=auto environment variable. see: https://docs.astral.sh/uv/guides/integration/pytorch/#using-uv-with-pytorch
this requires us to use uv pip to install the dependency, which means a slightly more involved shell command but I think the juice will be worth the squeeze (assumption: we already have a utility to parse the script metadata and/or an Image/Environment object to determine when torch is actually a dependency)
uv has first-class support for automatically navigating the matrix of pytorch indexes/builds/gpu variants etc when using uv pip based on the
UV_TORCH_BACKEND=autoenvironment variable. see: https://docs.astral.sh/uv/guides/integration/pytorch/#using-uv-with-pytorchthis requires us to use
uv pipto install the dependency, which means a slightly more involved shell command but I think the juice will be worth the squeeze (assumption: we already have a utility to parse the script metadata and/or anImage/Environmentobject to determine when torch is actually a dependency)