-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add logging to the uv build backend #15533
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add support for `RUST_LOG` to the uv build backend. While we were previously using logging statements in the uv build backend, they could only be shown when when using the direct build fast path through uv, as there was no tracing subscriber to write log messages out. This means no debug logging when using the build backend through pip, `python -m build`, an incompatible version of uv, or any other build frontend; No option to figure why includes and excludes behave the way they do.
This PR closes this gap by adding a tracing subscriber. The only option to enable it is `RUST_LOG`, as we don't have a CLI. The formatting style is the same as for uv, and color is also support in the same way, albeit only through anstream's support for TTYs and environment variables. We recommend only `RUST_LOG=uv=debug` and `RUST_LOG=uv=verbose` in the docs, but this can be used to debug into crates such as `glob`, too.
**Before**
```
$ pip wheel . -v [...]
Looking in links: /home/konsti/projects/uv/target/wheels/
Processing /home/konsti/projects/uv/scripts/packages/built-by-uv
Running command pip subprocess to install build dependencies
Looking in links: /home/konsti/projects/uv/target/wheels/
Processing /home/konsti/projects/uv/target/wheels/uv_build-0.8.13-py3-none-manylinux_2_39_x86_64.whl
Installing collected packages: uv_build
Successfully installed uv_build-0.8.13
Installing build dependencies ... done
Running command Getting requirements to build wheel
Getting requirements to build wheel ... done
Running command Preparing metadata (pyproject.toml)
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: built-by-uv
Running command Building wheel for built-by-uv (pyproject.toml)
Error: Unsupported glob expression in: `tool.uv.build-backend.*-exclude`
Caused by:
Invalid character `!` at position 10 in glob: `**/build-*!$§%!½¼²¼³¬!§%$§%.h`. hint: Characters can be escaped with a backslash
error: subprocess-exited-with-error
× Building wheel for built-by-uv (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpow1illc9
cwd: /home/konsti/projects/uv/scripts/packages/built-by-uv
Building wheel for built-by-uv (pyproject.toml) ... error
ERROR: Failed building wheel for built-by-uv
Failed to build built-by-uv
ERROR: Failed to build one or more wheels
```
**After**
```
$ RUST_LOG=uv=debug pip wheel . -v [...]
Looking in links: /home/konsti/projects/uv/target/wheels/
Processing /home/konsti/projects/uv/scripts/packages/built-by-uv
Running command pip subprocess to install build dependencies
Looking in links: /home/konsti/projects/uv/target/wheels/
Processing /home/konsti/projects/uv/target/wheels/uv_build-0.8.13-py3-none-manylinux_2_39_x86_64.whl
Installing collected packages: uv_build
Successfully installed uv_build-0.8.13
Installing build dependencies ... done
Running command Getting requirements to build wheel
Getting requirements to build wheel ... done
Running command Preparing metadata (pyproject.toml)
DEBUG Writing metadata files to /tmp/pip-modern-metadata-l_kh78cj
DEBUG Found PEP 639 license declarations, using METADATA 2.4
DEBUG License files match: `LICENSE-APACHE`
DEBUG License files match: `LICENSE-MIT`
DEBUG License files match: `third-party-licenses/PEP-401.txt`
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: built-by-uv
Running command Building wheel for built-by-uv (pyproject.toml)
DEBUG Checking metadata directory /tmp/pip-modern-metadata-l_kh78cj/built_by_uv-0.1.0.dist-info
DEBUG Found PEP 639 license declarations, using METADATA 2.4
DEBUG License files match: `LICENSE-APACHE`
DEBUG License files match: `LICENSE-MIT`
DEBUG License files match: `third-party-licenses/PEP-401.txt`
DEBUG Writing wheel at /tmp/pip-wheel-bu6to9i7/built_by_uv-0.1.0-py3-none-any.whl
DEBUG Wheel excludes: ["__pycache__", "*.pyc", "*.pyo", "build-*!$§%!½¼²¼³¬!§%$§%.h", "/src/built_by_uv/not-packaged.txt"]
Error: Unsupported glob expression in: `tool.uv.build-backend.*-exclude`
Caused by:
Invalid character `!` at position 10 in glob: `**/build-*!$§%!½¼²¼³¬!§%$§%.h`. hint: Characters can be escaped with a backslash
error: subprocess-exited-with-error
× Building wheel for built-by-uv (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
full command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py build_wheel /tmp/tmpjrxou13a
cwd: /home/konsti/projects/uv/scripts/packages/built-by-uv
Building wheel for built-by-uv (pyproject.toml) ... error
ERROR: Failed building wheel for built-by-uv
Failed to build built-by-uv
ERROR: Failed to build one or more wheels
```
(There is no color in the above uv log statements, as pip doesn't register as a TTY)
Fixes #12723
zanieb
approved these changes
Aug 26, 2025
BurntSushi
approved these changes
Aug 26, 2025
tmeijn
pushed a commit
to tmeijn/dotfiles
that referenced
this pull request
Sep 2, 2025
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.8.13` -> `0.8.14` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>astral-sh/uv (astral-sh/uv)</summary> ### [`v0.8.14`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0814) [Compare Source](astral-sh/uv@0.8.13...0.8.14) ##### Python - Add managed CPython distributions for aarch64 musl ##### Enhancements - Add `--python-platform` to `uv pip check` ([#​15486](astral-sh/uv#15486)) - Add an environment variable for `UV_ISOLATED` ([#​15428](astral-sh/uv#15428)) - Add logging to the uv build backend ([#​15533](astral-sh/uv#15533)) - Allow more trailing null bytes in zip files ([#​15452](astral-sh/uv#15452)) - Allow pinning managed Python versions to specific build versions ([#​15314](astral-sh/uv#15314)) - Cache PyTorch wheels by default ([#​15481](astral-sh/uv#15481)) - Reject already-installed wheels that don't match the target platform ([#​15484](astral-sh/uv#15484)) - Add `--no-install-local` option to `uv sync`, `uv add` and `uv export` ([#​15328](astral-sh/uv#15328)) - Include cycle error message in `uv pip` CLI ([#​15453](astral-sh/uv#15453)) ##### Preview features - Fix format of `{version}` on `uv format` failure ([#​15527](astral-sh/uv#15527)) - Lock during installs in `uv format` to prevent races ([#​15551](astral-sh/uv#15551)) - Respect `--project` in `uv format` ([#​15438](astral-sh/uv#15438)) - Run `uv format` in the project root ([#​15440](astral-sh/uv#15440)) ##### Configuration - Add file-to-CLI overrides for build isolation configuration ([#​15437](astral-sh/uv#15437)) - Add file-to-CLI overrides for reinstall configuration ([#​15426](astral-sh/uv#15426)) ##### Performance - Cache `WHEEL` and `METADATA` reads in installed distributions ([#​15489](astral-sh/uv#15489)) ##### Bug fixes - Avoid erroring when creating `venv` in current working directory ([#​15537](astral-sh/uv#15537)) - Avoid introducing unnecessary system dependency on CUDA ([#​15449](astral-sh/uv#15449)) - Clear discovered site packages when creating virtual environment ([#​15522](astral-sh/uv#15522)) - Read index credentials from the environment during `uv publish` checks ([#​15545](astral-sh/uv#15545)) - Refuse to remove non-virtual environments in `uv venv` ([#​15538](astral-sh/uv#15538)) - Stop setting `CLICOLOR_FORCE=1` when calling build backends ([#​15472](astral-sh/uv#15472)) - Support file or directory removal for Windows symlinks ([#​15543](astral-sh/uv#15543)) ##### Documentation - Fix GitHub guide highlight lines ([#​15443](astral-sh/uv#15443)) - Move Resolver to new Internals section in the Reference ([#​15465](astral-sh/uv#15465)) - Split the "Authentication" page into sections ([#​15575](astral-sh/uv#15575)) - Update uninstall docs to mention `uvw.exe` needs to be removed ([#​15536](astral-sh/uv#15536)) </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS44OC4wIiwidXBkYXRlZEluVmVyIjoiNDEuODguMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for
RUST_LOGto the uv build backend. While we were previously using logging statements in the uv build backend, they could only be shown when when using the direct build fast path through uv, as there was no tracing subscriber to write log messages out. This means no debug logging when using the build backend through pip,python -m build, an incompatible version of uv, or any other build frontend; No option to figure why includes and excludes behave the way they do.This PR closes this gap by adding a tracing subscriber. The only option to enable it is
RUST_LOG, as we don't have a CLI. The formatting style is the same as for uv, and color is also support in the same way, albeit only through anstream's support for TTYs and environment variables. We recommend onlyRUST_LOG=uv=debugandRUST_LOG=uv=verbosein the docs, but this can be used to debug into crates such asglob, too.Before
After
(There is no color in the above uv log statements, as pip doesn't register as a TTY)
Fixes #12723