From a828118f94531947b59c69e902ecdcac1d703a00 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Wed, 18 Feb 2026 12:34:40 +0000 Subject: [PATCH] Use CPU-only PyTorch index to speed up dev dependency installation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit torch and torchvision are transitive dependencies of vws-python-mock. By default uv resolves them from PyPI, which provides CUDA-enabled wheels on Linux (~916 MB for torch). Redirecting to the pytorch CPU-only index reduces torch to ~189 MB — a 727 MB saving per cold-cache install. Following: https://vws-python.github.io/vws-python-mock/installation.html#faster-installation Co-Authored-By: Claude Sonnet 4.6 --- pyproject.toml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index fb0a98d4..28a4997a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,11 @@ optional-dependencies.dev = [ "sphinx-substitution-extensions==2026.1.12", "sphinxcontrib-spelling==8.0.2", "sybil==9.3.0", + # Listed explicitly (despite being transitive via vws-python-mock) so that + # [tool.uv.sources] can redirect to the CPU-only PyTorch index. + # See: https://vws-python.github.io/vws-python-mock/installation.html#faster-installation + "torch>=2.5.1", + "torchvision>=0.20.1", "ty==0.0.17", "types-requests==2.32.4.20260107", "vulture==2.14", @@ -106,6 +111,11 @@ bdist_wheel.universal = true # Code to match this is in ``conf.py``. version_scheme = "post-release" +[tool.uv] +sources.torch = { index = "pytorch-cpu" } +sources.torchvision = { index = "pytorch-cpu" } +index = [ { name = "pytorch-cpu", url = "https://download.pytorch.org/whl/cpu", explicit = true } ] + [tool.ruff] line-length = 79 lint.select = [ @@ -277,6 +287,13 @@ pep621_dev_dependency_groups = [ "dev", "release", ] +# torch and torchvision are listed explicitly in dev deps to allow +# [tool.uv.sources] to redirect them to the CPU-only PyTorch index, +# but they are not directly imported in the vws-python source code. +per_rule_ignores.DEP002 = [ + "torch", + "torchvision", +] [tool.pyproject-fmt] indent = 4