File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2029,6 +2029,13 @@ pub struct BuildArgs {
20292029 #[ arg( long) ]
20302030 pub wheel : bool ,
20312031
2032+ #[ arg( long, overrides_with( "no_build_logs" ) , hide = true ) ]
2033+ pub build_logs : bool ,
2034+
2035+ /// Hide logs from the build backend.
2036+ #[ arg( long, overrides_with( "build_logs" ) , hide = true ) ]
2037+ pub no_build_logs : bool ,
2038+
20322039 /// Constrain build dependencies using the given requirements files when building
20332040 /// distributions.
20342041 ///
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ pub(crate) async fn build(
3838 output_dir : Option < PathBuf > ,
3939 sdist : bool ,
4040 wheel : bool ,
41+ build_logs : bool ,
4142 build_constraints : Vec < RequirementsSource > ,
4243 hash_checking : Option < HashCheckingMode > ,
4344 python : Option < String > ,
@@ -58,6 +59,7 @@ pub(crate) async fn build(
5859 output_dir. as_deref ( ) ,
5960 sdist,
6061 wheel,
62+ build_logs,
6163 & build_constraints,
6264 hash_checking,
6365 python. as_deref ( ) ,
@@ -109,6 +111,7 @@ async fn build_impl(
109111 output_dir : Option < & Path > ,
110112 sdist : bool ,
111113 wheel : bool ,
114+ build_logs : bool ,
112115 build_constraints : & [ RequirementsSource ] ,
113116 hash_checking : Option < HashCheckingMode > ,
114117 python_request : Option < & str > ,
@@ -369,7 +372,13 @@ async fn build_impl(
369372 let dist = None ;
370373
371374 let build_output = match printer {
372- Printer :: Default | Printer :: NoProgress | Printer :: Verbose => BuildOutput :: Stderr ,
375+ Printer :: Default | Printer :: NoProgress | Printer :: Verbose => {
376+ if build_logs {
377+ BuildOutput :: Stderr
378+ } else {
379+ BuildOutput :: Quiet
380+ }
381+ }
373382 Printer :: Quiet => BuildOutput :: Quiet ,
374383 } ;
375384
Original file line number Diff line number Diff line change @@ -686,6 +686,7 @@ async fn run(cli: Cli) -> Result<ExitStatus> {
686686 args. out_dir ,
687687 args. sdist ,
688688 args. wheel ,
689+ args. build_logs ,
689690 build_constraints,
690691 args. hash_checking ,
691692 args. python ,
Original file line number Diff line number Diff line change @@ -1674,6 +1674,7 @@ pub(crate) struct BuildSettings {
16741674 pub ( crate ) out_dir : Option < PathBuf > ,
16751675 pub ( crate ) sdist : bool ,
16761676 pub ( crate ) wheel : bool ,
1677+ pub ( crate ) build_logs : bool ,
16771678 pub ( crate ) build_constraint : Vec < PathBuf > ,
16781679 pub ( crate ) hash_checking : Option < HashCheckingMode > ,
16791680 pub ( crate ) python : Option < String > ,
@@ -1695,6 +1696,8 @@ impl BuildSettings {
16951696 no_require_hashes,
16961697 verify_hashes,
16971698 no_verify_hashes,
1699+ build_logs,
1700+ no_build_logs,
16981701 python,
16991702 build,
17001703 refresh,
@@ -1707,6 +1710,7 @@ impl BuildSettings {
17071710 out_dir,
17081711 sdist,
17091712 wheel,
1713+ build_logs : flag ( build_logs, no_build_logs) . unwrap_or ( true ) ,
17101714 build_constraint : build_constraint
17111715 . into_iter ( )
17121716 . filter_map ( Maybe :: into_option)
Original file line number Diff line number Diff line change @@ -1521,3 +1521,41 @@ fn build_quiet() -> Result<()> {
15211521
15221522 Ok ( ( ) )
15231523}
1524+
1525+ #[ test]
1526+ fn build_no_build_logs ( ) -> Result < ( ) > {
1527+ let context = TestContext :: new ( "3.12" ) ;
1528+
1529+ let project = context. temp_dir . child ( "project" ) ;
1530+
1531+ let pyproject_toml = project. child ( "pyproject.toml" ) ;
1532+ pyproject_toml. write_str (
1533+ r#"
1534+ [project]
1535+ name = "project"
1536+ version = "0.1.0"
1537+ requires-python = ">=3.12"
1538+ dependencies = ["anyio==3.7.0"]
1539+
1540+ [build-system]
1541+ requires = ["setuptools>=42"]
1542+ build-backend = "setuptools.build_meta"
1543+ "# ,
1544+ ) ?;
1545+
1546+ project. child ( "src" ) . child ( "__init__.py" ) . touch ( ) ?;
1547+ project. child ( "README" ) . touch ( ) ?;
1548+
1549+ uv_snapshot ! ( & context. filters( ) , context. build( ) . arg( "project" ) . arg( "--no-build-logs" ) , @r###"
1550+ success: true
1551+ exit_code: 0
1552+ ----- stdout -----
1553+
1554+ ----- stderr -----
1555+ Building source distribution...
1556+ Building wheel from source distribution...
1557+ Successfully built project/dist/project-0.1.0.tar.gz and project/dist/project-0.1.0-py3-none-any.whl
1558+ "### ) ;
1559+
1560+ Ok ( ( ) )
1561+ }
You can’t perform that action at this time.
0 commit comments