Skip to content

Commit f24db3b

Browse files
adamtheturtleclaude
andcommitted
Use CPU-only PyTorch index to speed up dev dependency installation
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 <noreply@anthropic.com>
1 parent ba0de56 commit f24db3b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

pyproject.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ optional-dependencies.dev = [
7474
"sphinx-substitution-extensions==2026.1.12",
7575
"sphinxcontrib-spelling==8.0.2",
7676
"sybil==9.3.0",
77+
# Listed explicitly (despite being transitive via vws-python-mock) so that
78+
# [tool.uv.sources] can redirect to the CPU-only PyTorch index.
79+
# See: https://vws-python.github.io/vws-python-mock/installation.html#faster-installation
80+
"torch>=2.5.1",
81+
"torchvision>=0.20.1",
7782
"ty==0.0.17",
7883
"types-requests==2.32.4.20260107",
7984
"vulture==2.14",
@@ -106,6 +111,11 @@ bdist_wheel.universal = true
106111
# Code to match this is in ``conf.py``.
107112
version_scheme = "post-release"
108113

114+
[tool.uv]
115+
sources.torch = { index = "pytorch-cpu" }
116+
sources.torchvision = { index = "pytorch-cpu" }
117+
index = [ { name = "pytorch-cpu", url = "https://download.pytorch.org/whl/cpu", explicit = true } ]
118+
109119
[tool.ruff]
110120
line-length = 79
111121
lint.select = [
@@ -277,6 +287,13 @@ pep621_dev_dependency_groups = [
277287
"dev",
278288
"release",
279289
]
290+
# torch and torchvision are listed explicitly in dev deps to allow
291+
# [tool.uv.sources] to redirect them to the CPU-only PyTorch index,
292+
# but they are not directly imported in the vws-python source code.
293+
per_rule_ignores.DEP002 = [
294+
"torch",
295+
"torchvision",
296+
]
280297

281298
[tool.pyproject-fmt]
282299
indent = 4

0 commit comments

Comments
 (0)