@@ -335,6 +335,21 @@ pub enum Commands {
335
335
after_long_help = ""
336
336
) ]
337
337
Venv ( VenvArgs ) ,
338
+ /// Build Python packages into source distributions and wheels.
339
+ ///
340
+ /// By default, `uv build` will build a source distribution ("sdist")
341
+ /// from the source directory, and a binary distribution ("wheel") from
342
+ /// the source distribution.
343
+ ///
344
+ /// `uv build --sdist` can be used to build only the source distribution,
345
+ /// `uv build --wheel` can be used to build only the binary distribution,
346
+ /// and `uv build --sdist --wheel` can be used to build both distributions
347
+ /// from source.
348
+ #[ command(
349
+ after_help = "Use `uv help build` for more details." ,
350
+ after_long_help = ""
351
+ ) ]
352
+ Build ( BuildArgs ) ,
338
353
/// Manage uv's cache.
339
354
#[ command(
340
355
after_help = "Use `uv help cache` for more details." ,
@@ -1125,7 +1140,7 @@ pub struct PipSyncArgs {
1125
1140
1126
1141
/// The Python interpreter into which packages should be installed.
1127
1142
///
1128
- /// By default, syncing requires a virtual environment. An path to an
1143
+ /// By default, syncing requires a virtual environment. A path to an
1129
1144
/// alternative Python can be provided, but it is only recommended in
1130
1145
/// continuous integration (CI) environments and should be used with
1131
1146
/// caution, as it can modify the system Python installation.
@@ -1407,7 +1422,7 @@ pub struct PipInstallArgs {
1407
1422
1408
1423
/// The Python interpreter into which packages should be installed.
1409
1424
///
1410
- /// By default, installation requires a virtual environment. An path to an
1425
+ /// By default, installation requires a virtual environment. A path to an
1411
1426
/// alternative Python can be provided, but it is only recommended in
1412
1427
/// continuous integration (CI) environments and should be used with
1413
1428
/// caution, as it can modify the system Python installation.
@@ -1572,7 +1587,7 @@ pub struct PipUninstallArgs {
1572
1587
1573
1588
/// The Python interpreter from which packages should be uninstalled.
1574
1589
///
1575
- /// By default, uninstallation requires a virtual environment. An path to an
1590
+ /// By default, uninstallation requires a virtual environment. A path to an
1576
1591
/// alternative Python can be provided, but it is only recommended in
1577
1592
/// continuous integration (CI) environments and should be used with
1578
1593
/// caution, as it can modify the system Python installation.
@@ -1923,6 +1938,49 @@ pub struct PipTreeArgs {
1923
1938
pub compat_args : compat:: PipGlobalCompatArgs ,
1924
1939
}
1925
1940
1941
+ #[ derive( Args ) ]
1942
+ #[ allow( clippy:: struct_excessive_bools) ]
1943
+ pub struct BuildArgs {
1944
+ /// The directory from which source distributions and/or wheels should be built.
1945
+ ///
1946
+ /// Defaults to the current working directory.
1947
+ #[ arg( value_parser = parse_file_path) ]
1948
+ pub src_dir : Option < PathBuf > ,
1949
+
1950
+ /// Build a source distribution ("sdist") from the given directory.
1951
+ #[ arg( long) ]
1952
+ pub sdist : bool ,
1953
+
1954
+ /// Build a built distribution ("wheel") from the given directory.
1955
+ #[ arg( long) ]
1956
+ pub wheel : bool ,
1957
+
1958
+ /// The Python interpreter to use for the build environment.
1959
+ ///
1960
+ /// By default, builds are executed in isolated virtual environments. The
1961
+ /// discovered interpreter will be used to create those environments, and
1962
+ /// will be symlinked or copied in depending on the platform.
1963
+ ///
1964
+ /// See `uv help python` to view supported request formats.
1965
+ #[ arg(
1966
+ long,
1967
+ short,
1968
+ env = "UV_PYTHON" ,
1969
+ verbatim_doc_comment,
1970
+ help_heading = "Python options"
1971
+ ) ]
1972
+ pub python : Option < String > ,
1973
+
1974
+ #[ command( flatten) ]
1975
+ pub resolver : ResolverArgs ,
1976
+
1977
+ #[ command( flatten) ]
1978
+ pub build : BuildOptionsArgs ,
1979
+
1980
+ #[ command( flatten) ]
1981
+ pub refresh : RefreshArgs ,
1982
+ }
1983
+
1926
1984
#[ derive( Args ) ]
1927
1985
#[ allow( clippy:: struct_excessive_bools) ]
1928
1986
pub struct VenvArgs {
@@ -2298,7 +2356,7 @@ pub struct RunArgs {
2298
2356
pub installer : ResolverInstallerArgs ,
2299
2357
2300
2358
#[ command( flatten) ]
2301
- pub build : BuildArgs ,
2359
+ pub build : BuildOptionsArgs ,
2302
2360
2303
2361
#[ command( flatten) ]
2304
2362
pub refresh : RefreshArgs ,
@@ -2426,7 +2484,7 @@ pub struct SyncArgs {
2426
2484
pub installer : ResolverInstallerArgs ,
2427
2485
2428
2486
#[ command( flatten) ]
2429
- pub build : BuildArgs ,
2487
+ pub build : BuildOptionsArgs ,
2430
2488
2431
2489
#[ command( flatten) ]
2432
2490
pub refresh : RefreshArgs ,
@@ -2479,7 +2537,7 @@ pub struct LockArgs {
2479
2537
pub resolver : ResolverArgs ,
2480
2538
2481
2539
#[ command( flatten) ]
2482
- pub build : BuildArgs ,
2540
+ pub build : BuildOptionsArgs ,
2483
2541
2484
2542
#[ command( flatten) ]
2485
2543
pub refresh : RefreshArgs ,
@@ -2593,7 +2651,7 @@ pub struct AddArgs {
2593
2651
pub installer : ResolverInstallerArgs ,
2594
2652
2595
2653
#[ command( flatten) ]
2596
- pub build : BuildArgs ,
2654
+ pub build : BuildOptionsArgs ,
2597
2655
2598
2656
#[ command( flatten) ]
2599
2657
pub refresh : RefreshArgs ,
@@ -2662,7 +2720,7 @@ pub struct RemoveArgs {
2662
2720
pub installer : ResolverInstallerArgs ,
2663
2721
2664
2722
#[ command( flatten) ]
2665
- pub build : BuildArgs ,
2723
+ pub build : BuildOptionsArgs ,
2666
2724
2667
2725
#[ command( flatten) ]
2668
2726
pub refresh : RefreshArgs ,
@@ -2722,7 +2780,7 @@ pub struct TreeArgs {
2722
2780
pub frozen : bool ,
2723
2781
2724
2782
#[ command( flatten) ]
2725
- pub build : BuildArgs ,
2783
+ pub build : BuildOptionsArgs ,
2726
2784
2727
2785
#[ command( flatten) ]
2728
2786
pub resolver : ResolverArgs ,
@@ -2819,7 +2877,7 @@ pub struct ExportArgs {
2819
2877
pub resolver : ResolverArgs ,
2820
2878
2821
2879
#[ command( flatten) ]
2822
- pub build : BuildArgs ,
2880
+ pub build : BuildOptionsArgs ,
2823
2881
2824
2882
#[ command( flatten) ]
2825
2883
pub refresh : RefreshArgs ,
@@ -2966,7 +3024,7 @@ pub struct ToolRunArgs {
2966
3024
pub installer : ResolverInstallerArgs ,
2967
3025
2968
3026
#[ command( flatten) ]
2969
- pub build : BuildArgs ,
3027
+ pub build : BuildOptionsArgs ,
2970
3028
2971
3029
#[ command( flatten) ]
2972
3030
pub refresh : RefreshArgs ,
@@ -3018,7 +3076,7 @@ pub struct ToolInstallArgs {
3018
3076
pub installer : ResolverInstallerArgs ,
3019
3077
3020
3078
#[ command( flatten) ]
3021
- pub build : BuildArgs ,
3079
+ pub build : BuildOptionsArgs ,
3022
3080
3023
3081
#[ command( flatten) ]
3024
3082
pub refresh : RefreshArgs ,
@@ -3103,7 +3161,7 @@ pub struct ToolUpgradeArgs {
3103
3161
pub installer : ResolverInstallerArgs ,
3104
3162
3105
3163
#[ command( flatten) ]
3106
- pub build : BuildArgs ,
3164
+ pub build : BuildOptionsArgs ,
3107
3165
}
3108
3166
3109
3167
#[ derive( Args ) ]
@@ -3407,7 +3465,7 @@ pub struct RefreshArgs {
3407
3465
3408
3466
#[ derive( Args ) ]
3409
3467
#[ allow( clippy:: struct_excessive_bools) ]
3410
- pub struct BuildArgs {
3468
+ pub struct BuildOptionsArgs {
3411
3469
/// Don't build source distributions.
3412
3470
///
3413
3471
/// When enabled, resolving will not run arbitrary Python code. The cached wheels of
0 commit comments