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

Stream build backend output to debug! #6903

Merged
merged 2 commits into from
Sep 2, 2024
Merged

Conversation

charliermarsh
Copy link
Member

@charliermarsh charliermarsh commented Aug 31, 2024

Summary

We need to decide whether we want this in debug! or tracing!. We also probably (?) want to show this by default in uv build.

Closes #1567.

Closes #5893.

@charliermarsh charliermarsh added the tracing Verbose output and debugging label Aug 31, 2024
@charliermarsh
Copy link
Member Author

Screenshot 2024-08-31 at 7 48 30 PM

@charliermarsh
Copy link
Member Author

Confusingly these failing tests pass on my machine.

crates/uv-build/src/lib.rs Outdated Show resolved Hide resolved
@konstin
Copy link
Member

konstin commented Sep 2, 2024

Do we need to prefix builds when multiple ones are running in parallel, or generally to identify which one is which?

@konstin
Copy link
Member

konstin commented Sep 2, 2024

Tests are also passing on my linux machine

@charliermarsh
Copy link
Member Author

Do we need to prefix builds when multiple ones are running in parallel, or generally to identify which one is which?

I thought about this, but if you run -vvv, the tree structure seems fine to me.

@charliermarsh charliermarsh force-pushed the charlie/build-output branch 3 times, most recently from aebd4c8 to ea59bfe Compare September 2, 2024 18:45
@charliermarsh
Copy link
Member Author

Ok, figured it out -- I was dropping output from one stream as soon as the other completed.

@charliermarsh charliermarsh force-pushed the charlie/build-output branch 2 times, most recently from a963685 to 70a2e3f Compare September 2, 2024 18:53
@charliermarsh charliermarsh changed the base branch from charlie/sdist-from-wheel to main September 2, 2024 19:34
@charliermarsh charliermarsh enabled auto-merge (squash) September 2, 2024 19:37
@charliermarsh charliermarsh merged commit 6897001 into main Sep 2, 2024
57 checks passed
@charliermarsh charliermarsh deleted the charlie/build-output branch September 2, 2024 19:46
@henryiii
Copy link
Contributor

henryiii commented Sep 3, 2024

We also probably (?) want to show this by default in uv build.

Remember, this is the only way for a build backend like scikit-build-core, maturin, hatching, etc. to communicate with the user. Modern build backends are fairly careful with output, trying to just display useful information to the user, like compiler warnings, enabled components, etc. In my opinion, uv build . and uv pip install . should show output. I even think uv pip install numpy should show output if it's building a wheel, but that's probably too large a departure from pip and what people know. (Remember, most of the time it won't build!)

I think the reason it's hidden by default is a) setuptools produces a ton of pretty useless output, like every file it copies, b) pip was designed in a time when pre-compiled wheels for everything didn't exist, which meant every install produced stuff, while today most packages have wheels, and c) dependency output could get confusing. Very little of this makes sense, though, in the modern most-packages-have-wheels world, where most SDist-only packages are compiled packages where output is both helpful and keeps the terminal from just sitting idle for seconds to minutes (to hours in rare cases). But in the case of building from a source directory, I think it's easy to say hiding the build-backend output is never helpful. And again, this is the only way to see the build-backend produce output. You only interact to build backend via pip install . and build .!

Two issues with this as well, by the way. It looks like every line gets a long prefix with logging info (Correction: it appears to just be "DEBUG", which isn't bad), and it looks like the build backend can't tell things like the terminal width and color support. scikit-build-core, cmake, and most compilers all support color output, but it's gone with uv. What about also providing a flag that disables capturing the subprocess output? Pip has the same problem, but it only adds a couple of spaces as a prefix. This is why build's output is so much better than pips, as it doesn't buffer it and modify it.

Here's an example of build's output for boost-histogram, with scikit-build-core's logging enabled:

Screenshot 2024-09-03 at 2 14 28 AM

Now here's uv's current support:

Screenshot 2024-09-03 at 2 17 42 AM
Screenshot 2024-09-03 at 2 18 20 AM

There's about two pages of uv logging before the build backend info starts, it's got a DEBUG prefix on everything, and all color is gone.

Also, I noticed another problem. Without scikit-build-core's logging enabled, this is the entire output from pipx run build --wheel:

Screenshot 2024-09-03 at 2 32 22 AM

Notice that Ninja is rewriting its output if each file is successfully compiled, keeping the log short, because it knows it's writing to a terminal. However, you can't do that when you buffer! Here's the output part from uv:

Screenshot 2024-09-03 at 2 27 19 AM

Having a special flag to disable capturing the output would fix that too.

Edit: #6912 looks better, not sure about it supporting terminal detection though.

tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Sep 4, 2024
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.4.0` -> `0.4.4` |

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.4.4`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#044)

[Compare Source](astral-sh/uv@0.4.3...0.4.4)

##### Enhancements

-   Allow customizing the project environment path with `UV_PROJECT_ENVIRONMENT` ([#&#8203;6834](astral-sh/uv#6834))
-   Warn when `VIRTUAL_ENV` is set but will not be respected in project commands ([#&#8203;6864](astral-sh/uv#6864))
-   Add `--no-hashes` to `uv export` ([#&#8203;6954](astral-sh/uv#6954))
-   Make HTTP headers title case for backward compatibility ([#&#8203;6887](astral-sh/uv#6887))
-   Pin `.python-version` in `uv init` ([#&#8203;6869](astral-sh/uv#6869))
-   Support `file://` URLs for `UV_PYTHON_INSTALL_MIRROR` ([#&#8203;6950](astral-sh/uv#6950))
-   Introduce more docker tags for uv ([#&#8203;6053](astral-sh/uv#6053))

##### Bug fixes

-   Avoid canonicalizing the cache directory ([#&#8203;6949](astral-sh/uv#6949))
-   Show all PyPy versions in `uv python list --all-versions` ([#&#8203;6917](astral-sh/uv#6917))
-   Avoid incorrect `requires-python` marker simplifications ([#&#8203;6268](astral-sh/uv#6268))

##### Documentation

-   Add documentation for `UV_PROJECT_ENVIRONMENT` ([#&#8203;6987](astral-sh/uv#6987))
-   Add optional dependencies section to the lockfile document ([#&#8203;6982](astral-sh/uv#6982))
-   Document use of the `file://` scheme in Python installation mirrors ([#&#8203;6984](astral-sh/uv#6984))
-   Fix outdated references to the help menu documentation in the first steps page ([#&#8203;6980](astral-sh/uv#6980))
-   Show env option in CLI reference documentation ([#&#8203;6863](astral-sh/uv#6863))
-   Add bind mount example to `docker.md` ([#&#8203;6921](astral-sh/uv#6921))

### [`v0.4.3`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#043)

[Compare Source](astral-sh/uv@0.4.2...0.4.3)

##### Enhancements

-   Show build backend output when `--verbose` is provided ([#&#8203;6903](astral-sh/uv#6903))
-   Allow `uv sync --frozen --package` without copying member `pyproject.toml` ([#&#8203;6943](astral-sh/uv#6943))

##### Bug fixes

-   Avoid panic with missing temporary directory ([#&#8203;6929](astral-sh/uv#6929))
-   Avoid updating incorrect dependencies for sorted `uv add` ([#&#8203;6939](astral-sh/uv#6939))
-   Use lower-bound semantics for all Python compatibility comparisons ([#&#8203;6882](astral-sh/uv#6882))

### [`v0.4.2`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#042)

[Compare Source](astral-sh/uv@0.4.1...0.4.2)

##### Enhancements

-   Adding support for `.pyc`  files in `uv run` ([#&#8203;6886](astral-sh/uv#6886))
-   Treat missing `top_level.txt` as non-fatal ([#&#8203;6881](astral-sh/uv#6881))

##### Bug fixes

-   Fix `is_disjoint` check for supported environments ([#&#8203;6902](astral-sh/uv#6902))
-   Remove dangling archives in `uv cache clean ${package}` ([#&#8203;6915](astral-sh/uv#6915))
-   Error when discovered Python is incompatible with `--isolated` workspace ([#&#8203;6885](astral-sh/uv#6885))
-   Warn when discovered Python is incompatible with PEP 723 script ([#&#8203;6884](astral-sh/uv#6884))

### [`v0.4.1`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#041)

[Compare Source](astral-sh/uv@0.4.0...0.4.1)

##### Enhancements

-   Add `uv export --format requirements-txt` ([#&#8203;6778](astral-sh/uv#6778))
-   Allow `@` references in `uv tool install --from` ([#&#8203;6842](astral-sh/uv#6842))
-   Normalize version specifiers by sorting ([#&#8203;6333](astral-sh/uv#6333))
-   Respect the user's upper-bound in `requires-python` ([#&#8203;6824](astral-sh/uv#6824))
-   Use Windows registry to discover Python on Windows directly ([#&#8203;6761](astral-sh/uv#6761))
-   Hint at `--no-workspace` in `uv init` failures ([#&#8203;6815](astral-sh/uv#6815))
-   Update to last PyPy releases ([#&#8203;6784](astral-sh/uv#6784))

##### Bug fixes

-   Avoid deadlocks when multiple uv processes lock resources ([#&#8203;6790](astral-sh/uv#6790))
-   Expand tildes when matching against `PATH` ([#&#8203;6829](astral-sh/uv#6829))
-   Fix `uv init --no-project` alias ([#&#8203;6837](astral-sh/uv#6837))
-   Ignore pre-release segments when discovering via `requires-python` ([#&#8203;6813](astral-sh/uv#6813))
-   Support inline optional tables in `uv add` and `uv remove` ([#&#8203;6787](astral-sh/uv#6787))
-   Update default `hello.py` to pass `ruff format` ([#&#8203;6811](astral-sh/uv#6811))
-   Avoid stripping root for user path display ([#&#8203;6865](astral-sh/uv#6865))
-   Error when user-provided environments are disjoint with Python ([#&#8203;6841](astral-sh/uv#6841))
-   Retain alphabetical sorting for `pyproject.toml` in `uv add` operations ([#&#8203;6388](astral-sh/uv#6388))))

##### Documentation

-   Add a link to the multiple index docs in the alternative index guide ([#&#8203;6826](astral-sh/uv#6826))
-   Add docs for inline exclude newer in PEP 723 scripts ([#&#8203;6831](astral-sh/uv#6831))
-   Enumerate available Docker tags ([#&#8203;6768](astral-sh/uv#6768))
-   Omit `[pip]` section from configuration file docs ([#&#8203;6814](astral-sh/uv#6814))
-   Update `project.urls` in `pyproject.toml`  ([#&#8203;6844](astral-sh/uv#6844))
-   Add docs for AWS CodeArtifact usage ([#&#8203;6816](astral-sh/uv#6816))

##### Other changes

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
@henryiii
Copy link
Contributor

henryiii commented Sep 5, 2024

Actually, this is what it looks like for me now with 0.4.5:

Screenshot 2024-09-05 at 1 28 10 AM

Every line is three lines, two of them with DEBUG prefixes.

@charliermarsh
Copy link
Member Author

That’s strange, I’ll take a look. I don’t see that for other backends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracing Verbose output and debugging
Projects
None yet
3 participants