Skip to content
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

uv build should output information about built artifacts in machine-readable form. #12392

Open
scolby33 opened this issue Mar 22, 2025 · 4 comments
Labels
enhancement New feature or improvement to existing functionality

Comments

@scolby33
Copy link

Summary

I would like to use uv build as part of a pipeline (in particular, in a GitHub action, but this doesn't matter particularly) and further process the built artifacts. Right now, I have a couple of non-ideal options for this:

  1. parse the stderr output from the build invocation and look for the lines starting with Successfully built
  2. clear the dist/ directory before running uv build and then afterwards use a glob or something to get all the files in that directory, and assume that nothing extra snuck in

It would be good if uv could output the paths to the built artifacts in a machine-readable form (JSON? but I don't really care which). Alternatively, perhaps the built paths could be output on stdout, so no parsing is necessary to get the paths. (This would have the classic problem of filenames with newlines being problematic, but I'm not sure if that's really an issue here.)

Example

These are just examples, I'm not particularly concerned about exact formats

$ uv build --sdist --json
...snip...all current build output on stderr...
[{"path": "dist/foo-1.0.0.tar.gz", "type": "sdist", "successful": true}]  # on stdout

or

$ uv build
...snip...all current build output on stderr...
Successfully built dist/foo-1.0.0.tar.gz  # still on stderr
Successfully built dist/foo-1.0.0-py3-none-any.whl  # still on stderr
dist/foo-1.0.0.tar.gz  # stdout
dist/foo-1.0.0-py3-none-any.whl  # stdout
@scolby33 scolby33 added the enhancement New feature or improvement to existing functionality label Mar 22, 2025
@zanieb
Copy link
Member

zanieb commented Mar 22, 2025

See also #411 — we want to do this everywhere but need to build some patterns to make it maintainable.

@zanieb
Copy link
Member

zanieb commented Mar 22, 2025

Maybe we could use -q here (#12300) to just print the file names? cc @Gankra

@scolby33
Copy link
Author

In the meantime, would it be possible to document/"promise" not to change the output format from Successfully built {--out-dir}/{filename}? (I believe currently defined here)

@charliermarsh
Copy link
Member

@scolby33 -- If we change that output, I think we would consider it breaking (so, per our versioning policy, it would only change in a minor (and not a patch) release).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement to existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants