Skip to content

Commit 658ca89

Browse files
Use sys_platform in lieu of platform_system in PyTorch docs (#11113)
## Summary This is what we use in the lockfile. I believe it's preferable, and it's also more concise.
1 parent 9f8cd92 commit 658ca89

File tree

1 file changed

+24
-24
lines changed

1 file changed

+24
-24
lines changed

docs/guides/integration/pytorch.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -142,81 +142,81 @@ Next, update the `pyproject.toml` to point `torch` and `torchvision` to the desi
142142

143143
=== "CUDA 11.8"
144144

145-
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `platform_system` to instruct uv to use
145+
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `sys_platform` to instruct uv to use
146146
the PyTorch index on Linux and Windows, but fall back to PyPI on macOS:
147147

148148
```toml
149149
[tool.uv.sources]
150150
torch = [
151-
{ index = "pytorch-cu118", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
151+
{ index = "pytorch-cu118", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
152152
]
153153
torchvision = [
154-
{ index = "pytorch-cu118", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
154+
{ index = "pytorch-cu118", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
155155
]
156156
```
157157

158158
=== "CUDA 12.1"
159159

160-
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `platform_system` to instruct uv to limit
160+
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `sys_platform` to instruct uv to limit
161161
the PyTorch index to Linux and Windows, falling back to PyPI on macOS:
162162

163163
```toml
164164
[tool.uv.sources]
165165
torch = [
166-
{ index = "pytorch-cu121", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
166+
{ index = "pytorch-cu121", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
167167
]
168168
torchvision = [
169-
{ index = "pytorch-cu121", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
169+
{ index = "pytorch-cu121", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
170170
]
171171
```
172172

173173
=== "CUDA 12.4"
174174

175-
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `platform_system` to instruct uv to limit
175+
PyTorch doesn't publish CUDA builds for macOS. As such, we gate on `sys_platform` to instruct uv to limit
176176
the PyTorch index to Linux and Windows, falling back to PyPI on macOS:
177177

178178
```toml
179179
[tool.uv.sources]
180180
torch = [
181-
{ index = "pytorch-cu124", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
181+
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
182182
]
183183
torchvision = [
184-
{ index = "pytorch-cu124", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
184+
{ index = "pytorch-cu124", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
185185
]
186186
```
187187

188188
=== "ROCm6"
189189

190-
PyTorch doesn't publish ROCm6 builds for macOS or Windows. As such, we gate on `platform_system` to instruct uv
190+
PyTorch doesn't publish ROCm6 builds for macOS or Windows. As such, we gate on `sys_platform` to instruct uv
191191
to limit the PyTorch index to Linux, falling back to PyPI on macOS and Windows:
192192

193193
```toml
194194
[tool.uv.sources]
195195
torch = [
196-
{ index = "pytorch-rocm", marker = "platform_system == 'Linux'" },
196+
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
197197
]
198198
torchvision = [
199-
{ index = "pytorch-rocm", marker = "platform_system == 'Linux'" },
199+
{ index = "pytorch-rocm", marker = "sys_platform == 'linux'" },
200200
]
201201
```
202202

203203
=== "Intel GPUs"
204204

205-
PyTorch doesn't publish Intel GPU builds for macOS. As such, we gate on `platform_system` to instruct uv to limit
205+
PyTorch doesn't publish Intel GPU builds for macOS. As such, we gate on `sys_platform` to instruct uv to limit
206206
the PyTorch index to Linux and Windows, falling back to PyPI on macOS:
207207

208208
```toml
209209
[tool.uv.sources]
210210
torch = [
211-
{ index = "pytorch-xpu", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
211+
{ index = "pytorch-xpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
212212
]
213213
torchvision = [
214-
{ index = "pytorch-xpu", marker = "platform_system == 'Linux' or platform_system == 'Windows'" },
214+
{ index = "pytorch-xpu", marker = "sys_platform == 'linux' or sys_platform == 'win32'" },
215215
]
216216
# Intel GPU support relies on `pytorch-triton-xpu` on Linux, which should also be installed from the PyTorch index
217217
# (and included in `project.dependencies`).
218218
pytorch-triton-xpu = [
219-
{ index = "pytorch-xpu", marker = "platform_system == 'Linux'" },
219+
{ index = "pytorch-xpu", marker = "sys_platform == 'linux'" },
220220
]
221221
```
222222

@@ -267,12 +267,12 @@ dependencies = [
267267

268268
[tool.uv.sources]
269269
torch = [
270-
{ index = "pytorch-cpu", marker = "platform_system == 'Windows'" },
271-
{ index = "pytorch-cu124", marker = "platform_system == 'Linux'" },
270+
{ index = "pytorch-cpu", marker = "sys_platform == 'win32'" },
271+
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
272272
]
273273
torchvision = [
274-
{ index = "pytorch-cpu", marker = "platform_system == 'Windows'" },
275-
{ index = "pytorch-cu124", marker = "platform_system == 'Linux'" },
274+
{ index = "pytorch-cpu", marker = "sys_platform == 'win32'" },
275+
{ index = "pytorch-cu124", marker = "sys_platform == 'linux'" },
276276
]
277277

278278
[[tool.uv.index]]
@@ -297,18 +297,18 @@ requires-python = ">=3.12.0"
297297
dependencies = [
298298
"torch>=2.5.1",
299299
"torchvision>=0.20.1",
300-
"pytorch-triton-xpu>=3.2.0 ; platform_system == 'Linux'",
300+
"pytorch-triton-xpu>=3.2.0 ; sys_platform == 'linux'",
301301
]
302302

303303
[tool.uv.sources]
304304
torch = [
305-
{ index = "pytorch-xpu", marker = "platform_system == 'Windows' or platform_system == 'Linux'" },
305+
{ index = "pytorch-xpu", marker = "sys_platform == 'win32' or sys_platform == 'linux'" },
306306
]
307307
torchvision = [
308-
{ index = "pytorch-xpu", marker = "platform_system == 'Windows' or platform_system == 'Linux'" },
308+
{ index = "pytorch-xpu", marker = "sys_platform == 'win32' or sys_platform == 'linux'" },
309309
]
310310
pytorch-triton-xpu = [
311-
{ index = "pytorch-xpu", marker = "platform_system == 'Linux'" },
311+
{ index = "pytorch-xpu", marker = "sys_platform == 'linux'" },
312312
]
313313

314314
[[tool.uv.index]]

0 commit comments

Comments
 (0)