@@ -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 ,
@@ -2452,7 +2516,7 @@ pub struct SyncArgs {
2452
2516
pub installer : ResolverInstallerArgs ,
2453
2517
2454
2518
#[ command( flatten) ]
2455
- pub build : BuildArgs ,
2519
+ pub build : BuildOptionsArgs ,
2456
2520
2457
2521
#[ command( flatten) ]
2458
2522
pub refresh : RefreshArgs ,
@@ -2505,7 +2569,7 @@ pub struct LockArgs {
2505
2569
pub resolver : ResolverArgs ,
2506
2570
2507
2571
#[ command( flatten) ]
2508
- pub build : BuildArgs ,
2572
+ pub build : BuildOptionsArgs ,
2509
2573
2510
2574
#[ command( flatten) ]
2511
2575
pub refresh : RefreshArgs ,
@@ -2619,7 +2683,7 @@ pub struct AddArgs {
2619
2683
pub installer : ResolverInstallerArgs ,
2620
2684
2621
2685
#[ command( flatten) ]
2622
- pub build : BuildArgs ,
2686
+ pub build : BuildOptionsArgs ,
2623
2687
2624
2688
#[ command( flatten) ]
2625
2689
pub refresh : RefreshArgs ,
@@ -2688,7 +2752,7 @@ pub struct RemoveArgs {
2688
2752
pub installer : ResolverInstallerArgs ,
2689
2753
2690
2754
#[ command( flatten) ]
2691
- pub build : BuildArgs ,
2755
+ pub build : BuildOptionsArgs ,
2692
2756
2693
2757
#[ command( flatten) ]
2694
2758
pub refresh : RefreshArgs ,
@@ -2748,7 +2812,7 @@ pub struct TreeArgs {
2748
2812
pub frozen : bool ,
2749
2813
2750
2814
#[ command( flatten) ]
2751
- pub build : BuildArgs ,
2815
+ pub build : BuildOptionsArgs ,
2752
2816
2753
2817
#[ command( flatten) ]
2754
2818
pub resolver : ResolverArgs ,
@@ -2853,7 +2917,7 @@ pub struct ExportArgs {
2853
2917
pub resolver : ResolverArgs ,
2854
2918
2855
2919
#[ command( flatten) ]
2856
- pub build : BuildArgs ,
2920
+ pub build : BuildOptionsArgs ,
2857
2921
2858
2922
#[ command( flatten) ]
2859
2923
pub refresh : RefreshArgs ,
@@ -3000,7 +3064,7 @@ pub struct ToolRunArgs {
3000
3064
pub installer : ResolverInstallerArgs ,
3001
3065
3002
3066
#[ command( flatten) ]
3003
- pub build : BuildArgs ,
3067
+ pub build : BuildOptionsArgs ,
3004
3068
3005
3069
#[ command( flatten) ]
3006
3070
pub refresh : RefreshArgs ,
@@ -3052,7 +3116,7 @@ pub struct ToolInstallArgs {
3052
3116
pub installer : ResolverInstallerArgs ,
3053
3117
3054
3118
#[ command( flatten) ]
3055
- pub build : BuildArgs ,
3119
+ pub build : BuildOptionsArgs ,
3056
3120
3057
3121
#[ command( flatten) ]
3058
3122
pub refresh : RefreshArgs ,
@@ -3137,7 +3201,7 @@ pub struct ToolUpgradeArgs {
3137
3201
pub installer : ResolverInstallerArgs ,
3138
3202
3139
3203
#[ command( flatten) ]
3140
- pub build : BuildArgs ,
3204
+ pub build : BuildOptionsArgs ,
3141
3205
}
3142
3206
3143
3207
#[ derive( Args ) ]
@@ -3441,7 +3505,7 @@ pub struct RefreshArgs {
3441
3505
3442
3506
#[ derive( Args ) ]
3443
3507
#[ allow( clippy:: struct_excessive_bools) ]
3444
- pub struct BuildArgs {
3508
+ pub struct BuildOptionsArgs {
3445
3509
/// Don't build source distributions.
3446
3510
///
3447
3511
/// When enabled, resolving will not run arbitrary Python code. The cached wheels of
0 commit comments