@@ -21,6 +21,7 @@ use uv_pypi_types::VerbatimParsedUrl;
21
21
use uv_python:: { PythonDownloads , PythonPreference , PythonVersion } ;
22
22
use uv_resolver:: { AnnotationStyle , ExcludeNewer , ForkStrategy , PrereleaseMode , ResolutionMode } ;
23
23
use uv_static:: EnvVars ;
24
+ use uv_torch:: TorchMode ;
24
25
25
26
pub mod comma;
26
27
pub mod compat;
@@ -1258,6 +1259,19 @@ pub struct PipCompileArgs {
1258
1259
#[ arg( long, overrides_with( "emit_index_annotation" ) , hide = true ) ]
1259
1260
pub no_emit_index_annotation : bool ,
1260
1261
1262
+ /// The backend to use when fetching packages in the `PyTorch` ecosystem (e.g., `cu126` or `auto`)
1263
+ ///
1264
+ /// When set, uv will ignore the configured index URLs for packages in the `PyTorch` ecosystem,
1265
+ /// and will instead use the defined backend.
1266
+ ///
1267
+ /// For example, when set to `cpu`, uv will use the CPU-only `PyTorch` index; when set to `cu126`,
1268
+ /// uv will use the `PyTorch` index for CUDA 12.6.
1269
+ ///
1270
+ /// The `auto` mode will attempt to detect the appropriate `PyTorch` index based on the currently
1271
+ /// installed CUDA drivers.
1272
+ #[ arg( long, value_enum) ]
1273
+ pub torch_backend : Option < TorchMode > ,
1274
+
1261
1275
#[ command( flatten) ]
1262
1276
pub compat_args : compat:: PipCompileCompatArgs ,
1263
1277
}
@@ -1499,6 +1513,19 @@ pub struct PipSyncArgs {
1499
1513
#[ arg( long) ]
1500
1514
pub dry_run : bool ,
1501
1515
1516
+ /// The backend to use when fetching packages in the `PyTorch` ecosystem (e.g., `cu126` or `auto`)
1517
+ ///
1518
+ /// When set, uv will ignore the configured index URLs for packages in the `PyTorch` ecosystem,
1519
+ /// and will instead use the defined backend.
1520
+ ///
1521
+ /// For example, when set to `cpu`, uv will use the CPU-only `PyTorch` index; when set to `cu126`,
1522
+ /// uv will use the `PyTorch` index for CUDA 12.6.
1523
+ ///
1524
+ /// The `auto` mode will attempt to detect the appropriate `PyTorch` index based on the currently
1525
+ /// installed CUDA drivers.
1526
+ #[ arg( long, value_enum) ]
1527
+ pub torch_backend : Option < TorchMode > ,
1528
+
1502
1529
#[ command( flatten) ]
1503
1530
pub compat_args : compat:: PipSyncCompatArgs ,
1504
1531
}
@@ -1791,6 +1818,19 @@ pub struct PipInstallArgs {
1791
1818
#[ arg( long) ]
1792
1819
pub dry_run : bool ,
1793
1820
1821
+ /// The backend to use when fetching packages in the `PyTorch` ecosystem (e.g., `cu126` or `auto`)
1822
+ ///
1823
+ /// When set, uv will ignore the configured index URLs for packages in the `PyTorch` ecosystem,
1824
+ /// and will instead use the defined backend.
1825
+ ///
1826
+ /// For example, when set to `cpu`, uv will use the CPU-only `PyTorch` index; when set to `cu126`,
1827
+ /// uv will use the `PyTorch` index for CUDA 12.6.
1828
+ ///
1829
+ /// The `auto` mode will attempt to detect the appropriate `PyTorch` index based on the currently
1830
+ /// installed CUDA drivers.
1831
+ #[ arg( long, value_enum) ]
1832
+ pub torch_backend : Option < TorchMode > ,
1833
+
1794
1834
#[ command( flatten) ]
1795
1835
pub compat_args : compat:: PipInstallCompatArgs ,
1796
1836
}
0 commit comments