@@ -339,6 +339,21 @@ pub enum Commands {
339
339
after_long_help = ""
340
340
) ]
341
341
Venv ( VenvArgs ) ,
342
+ /// Build Python packages into source distributions and wheels.
343
+ ///
344
+ /// By default, `uv build` will build a source distribution ("sdist")
345
+ /// from the source directory, and a binary distribution ("wheel") from
346
+ /// the source distribution.
347
+ ///
348
+ /// `uv build --sdist` can be used to build only the source distribution,
349
+ /// `uv build --wheel` can be used to build only the binary distribution,
350
+ /// and `uv build --sdist --wheel` can be used to build both distributions
351
+ /// from source.
352
+ #[ command(
353
+ after_help = "Use `uv help build` for more details." ,
354
+ after_long_help = ""
355
+ ) ]
356
+ Build ( BuildArgs ) ,
342
357
/// Manage uv's cache.
343
358
#[ command(
344
359
after_help = "Use `uv help cache` for more details." ,
@@ -1126,7 +1141,7 @@ pub struct PipSyncArgs {
1126
1141
1127
1142
/// The Python interpreter into which packages should be installed.
1128
1143
///
1129
- /// By default, syncing requires a virtual environment. An path to an
1144
+ /// By default, syncing requires a virtual environment. A path to an
1130
1145
/// alternative Python can be provided, but it is only recommended in
1131
1146
/// continuous integration (CI) environments and should be used with
1132
1147
/// caution, as it can modify the system Python installation.
@@ -1408,7 +1423,7 @@ pub struct PipInstallArgs {
1408
1423
1409
1424
/// The Python interpreter into which packages should be installed.
1410
1425
///
1411
- /// By default, installation requires a virtual environment. An path to an
1426
+ /// By default, installation requires a virtual environment. A path to an
1412
1427
/// alternative Python can be provided, but it is only recommended in
1413
1428
/// continuous integration (CI) environments and should be used with
1414
1429
/// caution, as it can modify the system Python installation.
@@ -1573,7 +1588,7 @@ pub struct PipUninstallArgs {
1573
1588
1574
1589
/// The Python interpreter from which packages should be uninstalled.
1575
1590
///
1576
- /// By default, uninstallation requires a virtual environment. An path to an
1591
+ /// By default, uninstallation requires a virtual environment. A path to an
1577
1592
/// alternative Python can be provided, but it is only recommended in
1578
1593
/// continuous integration (CI) environments and should be used with
1579
1594
/// caution, as it can modify the system Python installation.
@@ -1924,6 +1939,55 @@ pub struct PipTreeArgs {
1924
1939
pub compat_args : compat:: PipGlobalCompatArgs ,
1925
1940
}
1926
1941
1942
+ #[ derive( Args ) ]
1943
+ #[ allow( clippy:: struct_excessive_bools) ]
1944
+ pub struct BuildArgs {
1945
+ /// The directory from which distributions should be built.
1946
+ ///
1947
+ /// Defaults to the current working directory.
1948
+ #[ arg( value_parser = parse_file_path) ]
1949
+ pub src_dir : Option < PathBuf > ,
1950
+
1951
+ /// The output directory to which distributions should be written.
1952
+ ///
1953
+ /// Defaults to the `dist` subdirectory within the source directory.
1954
+ #[ arg( long, short, value_parser = parse_file_path) ]
1955
+ pub out_dir : Option < PathBuf > ,
1956
+
1957
+ /// Build a source distribution ("sdist") from the given directory.
1958
+ #[ arg( long) ]
1959
+ pub sdist : bool ,
1960
+
1961
+ /// Build a binary distribution ("wheel") from the given directory.
1962
+ #[ arg( long) ]
1963
+ pub wheel : bool ,
1964
+
1965
+ /// The Python interpreter to use for the build environment.
1966
+ ///
1967
+ /// By default, builds are executed in isolated virtual environments. The
1968
+ /// discovered interpreter will be used to create those environments, and
1969
+ /// will be symlinked or copied in depending on the platform.
1970
+ ///
1971
+ /// See `uv help python` to view supported request formats.
1972
+ #[ arg(
1973
+ long,
1974
+ short,
1975
+ env = "UV_PYTHON" ,
1976
+ verbatim_doc_comment,
1977
+ help_heading = "Python options"
1978
+ ) ]
1979
+ pub python : Option < String > ,
1980
+
1981
+ #[ command( flatten) ]
1982
+ pub resolver : ResolverArgs ,
1983
+
1984
+ #[ command( flatten) ]
1985
+ pub build : BuildOptionsArgs ,
1986
+
1987
+ #[ command( flatten) ]
1988
+ pub refresh : RefreshArgs ,
1989
+ }
1990
+
1927
1991
#[ derive( Args ) ]
1928
1992
#[ allow( clippy:: struct_excessive_bools) ]
1929
1993
pub struct VenvArgs {
@@ -2318,7 +2382,7 @@ pub struct RunArgs {
2318
2382
pub installer : ResolverInstallerArgs ,
2319
2383
2320
2384
#[ command( flatten) ]
2321
- pub build : BuildArgs ,
2385
+ pub build : BuildOptionsArgs ,
2322
2386
2323
2387
#[ command( flatten) ]
2324
2388
pub refresh : RefreshArgs ,
@@ -2446,7 +2510,7 @@ pub struct SyncArgs {
2446
2510
pub installer : ResolverInstallerArgs ,
2447
2511
2448
2512
#[ command( flatten) ]
2449
- pub build : BuildArgs ,
2513
+ pub build : BuildOptionsArgs ,
2450
2514
2451
2515
#[ command( flatten) ]
2452
2516
pub refresh : RefreshArgs ,
@@ -2499,7 +2563,7 @@ pub struct LockArgs {
2499
2563
pub resolver : ResolverArgs ,
2500
2564
2501
2565
#[ command( flatten) ]
2502
- pub build : BuildArgs ,
2566
+ pub build : BuildOptionsArgs ,
2503
2567
2504
2568
#[ command( flatten) ]
2505
2569
pub refresh : RefreshArgs ,
@@ -2613,7 +2677,7 @@ pub struct AddArgs {
2613
2677
pub installer : ResolverInstallerArgs ,
2614
2678
2615
2679
#[ command( flatten) ]
2616
- pub build : BuildArgs ,
2680
+ pub build : BuildOptionsArgs ,
2617
2681
2618
2682
#[ command( flatten) ]
2619
2683
pub refresh : RefreshArgs ,
@@ -2682,7 +2746,7 @@ pub struct RemoveArgs {
2682
2746
pub installer : ResolverInstallerArgs ,
2683
2747
2684
2748
#[ command( flatten) ]
2685
- pub build : BuildArgs ,
2749
+ pub build : BuildOptionsArgs ,
2686
2750
2687
2751
#[ command( flatten) ]
2688
2752
pub refresh : RefreshArgs ,
@@ -2742,7 +2806,7 @@ pub struct TreeArgs {
2742
2806
pub frozen : bool ,
2743
2807
2744
2808
#[ command( flatten) ]
2745
- pub build : BuildArgs ,
2809
+ pub build : BuildOptionsArgs ,
2746
2810
2747
2811
#[ command( flatten) ]
2748
2812
pub resolver : ResolverArgs ,
@@ -2847,7 +2911,7 @@ pub struct ExportArgs {
2847
2911
pub resolver : ResolverArgs ,
2848
2912
2849
2913
#[ command( flatten) ]
2850
- pub build : BuildArgs ,
2914
+ pub build : BuildOptionsArgs ,
2851
2915
2852
2916
#[ command( flatten) ]
2853
2917
pub refresh : RefreshArgs ,
@@ -2994,7 +3058,7 @@ pub struct ToolRunArgs {
2994
3058
pub installer : ResolverInstallerArgs ,
2995
3059
2996
3060
#[ command( flatten) ]
2997
- pub build : BuildArgs ,
3061
+ pub build : BuildOptionsArgs ,
2998
3062
2999
3063
#[ command( flatten) ]
3000
3064
pub refresh : RefreshArgs ,
@@ -3046,7 +3110,7 @@ pub struct ToolInstallArgs {
3046
3110
pub installer : ResolverInstallerArgs ,
3047
3111
3048
3112
#[ command( flatten) ]
3049
- pub build : BuildArgs ,
3113
+ pub build : BuildOptionsArgs ,
3050
3114
3051
3115
#[ command( flatten) ]
3052
3116
pub refresh : RefreshArgs ,
@@ -3131,7 +3195,7 @@ pub struct ToolUpgradeArgs {
3131
3195
pub installer : ResolverInstallerArgs ,
3132
3196
3133
3197
#[ command( flatten) ]
3134
- pub build : BuildArgs ,
3198
+ pub build : BuildOptionsArgs ,
3135
3199
}
3136
3200
3137
3201
#[ derive( Args ) ]
@@ -3435,7 +3499,7 @@ pub struct RefreshArgs {
3435
3499
3436
3500
#[ derive( Args ) ]
3437
3501
#[ allow( clippy:: struct_excessive_bools) ]
3438
- pub struct BuildArgs {
3502
+ pub struct BuildOptionsArgs {
3439
3503
/// Don't build source distributions.
3440
3504
///
3441
3505
/// When enabled, resolving will not run arbitrary Python code. The cached wheels of
0 commit comments