Skip to content

Comments

Use CPU-only PyTorch index to speed up dev installation#2857

Merged
adamtheturtle merged 1 commit intomainfrom
adamtheturtle/bump-vws-mock-faster
Feb 18, 2026
Merged

Use CPU-only PyTorch index to speed up dev installation#2857
adamtheturtle merged 1 commit intomainfrom
adamtheturtle/bump-vws-mock-faster

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 18, 2026

Summary

  • vws-python-mock (a dev dependency) transitively requires torch and torchvision
  • By default, uv resolves these from PyPI which provides CUDA-enabled wheels on Linux (~916 MB for torch alone)
  • This PR follows the faster installation guide to redirect torch and torchvision to the CPU-only PyTorch index

Does it actually make installation faster?

Yes — tested empirically:

Package CUDA wheel (PyPI) CPU-only wheel Saving
torch (Linux, cp313) 916 MB 189 MB 727 MB
torchvision (Linux, cp313) 8 MB 2 MB 6 MB

~733 MB total reduction per cold-cache install on Linux CI runners.

Implementation notes

[tool.uv.sources] only applies to direct dependencies (not transitive ones), so torch and torchvision must be listed explicitly in optional-dependencies.dev for the source override to take effect. A deptry ignore is added since these packages are not directly imported in the vws-python source code.

🤖 Generated with Claude Code


Note

Low Risk
Only adjusts development dependency resolution and linting configuration; no runtime or production code paths are affected.

Overview
Speeds up dev installs by ensuring uv resolves torch/torchvision from the CPU-only PyTorch wheel index instead of large default Linux CUDA wheels.

This makes torch and torchvision explicit dev dependencies (even though they’re transitive via vws-python-mock) and configures [tool.uv] source/index overrides to point to https://download.pytorch.org/whl/cpu. deptry is updated to ignore DEP002 for these packages since they aren’t imported directly.

Written by Cursor Bugbot for commit a828118. This will update automatically on new commits. Configure here.

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>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.


[tool.uv]
sources.torch = { index = "pytorch-cpu" }
sources.torchvision = { index = "pytorch-cpu" }
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyTorch source redirect breaks macOS dev installation

Medium Severity

The sources.torch and sources.torchvision unconditionally redirect resolution to the pytorch-cpu index (download.pytorch.org/whl/cpu), which only hosts Linux and Windows wheels — not macOS. Since uv does not fall back to PyPI when a wheel is missing from an explicit index, dependency resolution will fail for any macOS developer. The project classifies as supporting Operating System :: POSIX (which includes macOS). Adding platform markers (e.g., marker = "sys_platform != 'darwin'") to the source entries would restrict the redirect to platforms where CPU-only wheels exist.

Additional Locations (1)

Fix in Cursor Fix in Web

@adamtheturtle adamtheturtle merged commit f24db3b into main Feb 18, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/bump-vws-mock-faster branch February 18, 2026 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant