Skip to content

fix: support wider range of verbosity settings on other build backends #2339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 6, 2025

Conversation

henryiii
Copy link
Contributor

@henryiii henryiii commented Mar 28, 2025

See #2338.

This makes the verbosity setting a bit more useful on other backends. This tries to map the current pip meanings to other backends. The key changes are:

  • <0 will support uv (feat: option to build directly with uv #2322), build continues to produce a warning. This is a feature that's been requested before for build, btw.
  • 1 continues to do nothing on non-pip backends
  • 2+ now passes multiple -v to non-pip backends, since both build and uv support adding extra resolving info (similar to pip's -vv) if passing -v.

@mayeut
Copy link
Member

mayeut commented Mar 29, 2025

Should we be trying to get something consistent between frontends ? i.e. 0 maps to -v with pip

@joerick
Copy link
Contributor

joerick commented Mar 30, 2025

Should we be trying to get something consistent between frontends ? i.e. 0 maps to -v with pip

If we want to keep this option, I like this idea. Previously I was in favour of a light-touch approach to adding arguments to pip wheel. But printing the build backend output by default makes a lot of sense in a CI scenario, and with build the default now, we're just making the option consistent between frontends.

so that would be

build pip uv desc
-2 not supported -q not supported quiet mode
-1 not supported -q reduce output, where supported
0 (default) -v print backend output (default)
1 -v -vv -v print log messages e.g. resolving info
2 -vv -vvv -vv print even more debug info

I think it would be nice to warn on unsupported settings i.e. (not supported, above) or outside -2...2.

The other approach, of course, is to avoid this mess, deprecate the build-verbosity option and refer users to build-frontend with the args: param. I'd be open to either, I think.

@henryiii
Copy link
Contributor Author

henryiii commented Mar 30, 2025

That is very similar to what I had, but with one difference: 0 is "native", which doesn't add any flags, keeping to the native behavior of the tool, and allows a user to use the args: if they prefer. If you set verbosity=1, that tells all backends to produce verbose output consistently.

build pip uv desc
-2 not supported -q not supported quiet mode
-1 not supported -q reduce output, where supported
0 (default) default for build tool
1 -v print backend output
2 -v -vv -v print log messages e.g. resolving info
3 -vv -vvv -vv print even more debug info

I prefer the default not adding flags (especially since we have a mechanism for users to add flags themselves). I expect most users won't change the default (which now produces build output because it uses build by default), or they'll want build output so they'll set verbose=1, which will produce build output on all backends. Plus this is backwards compatible, the values keep their meanings. Otherwise, 1 becomes too verbose, and a lot of projects have 1 set.

Since this is such an important feature, I like having the flag for it (probably not enough to have added it if we didn't already have it, but certainly happy to keep it). I have a verbose setting for scikit-build-core even though it's possible to manually pass through the verbosity flag go CMake, and it's been popular.

Co-authored-by: Matthieu Darbois <[email protected]>
@burgholzer
Copy link
Contributor

Just fyi:
Since 0.6.11, uv also supports -qq. See astral-sh/uv#12300

@joerick
Copy link
Contributor

joerick commented Mar 31, 2025

Yeah, seeing it in a table, I agree with you @henryiii. It's better to have a default that matches the build-frontend's default.

Plus this is backwards compatible, the values keep their meanings. Otherwise, 1 becomes too verbose, and a lot of projects have 1 set.

Also a good point.

@henryiii
Copy link
Contributor Author

Okay, new version. Added the table, and modified it a tiny bit after observing pip wheel . -q and uv build -q look identical, with no output normally. So that's now -1 in the table.

Signed-off-by: Henry Schreiner <[email protected]>
@henryiii henryiii force-pushed the henryiii/fix/verbositylevel branch from cd633eb to e2a3160 Compare March 31, 2025 14:47
@henryiii
Copy link
Contributor Author

Also, -vv works on build, even though I don't think it does anything different, I'm only warning and skipping if it is explicitly not supported.

Copy link
Contributor

@joerick joerick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@mayeut mayeut merged commit 2aaa489 into pypa:main Apr 6, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants