Skip to content

Conversation

blueraft
Copy link
Contributor

@blueraft blueraft commented Aug 13, 2025

Alternative to #15251.

As suggested in #15118 (comment)

Test Plan

cargo test

@blueraft blueraft force-pushed the use-pipreqs-build-error-hints branch from 27cd247 to c9459e3 Compare August 13, 2025 16:45
@blueraft blueraft force-pushed the use-pipreqs-build-error-hints branch from c9459e3 to d9940bd Compare August 13, 2025 20:08
@zanieb
Copy link
Member

zanieb commented Aug 13, 2025

Sorry I broke main!

@zanieb
Copy link
Member

zanieb commented Aug 13, 2025

I think you can test this with something like

uv/crates/uv/tests/it/sync.rs

Lines 1571 to 1601 in 323aa8f

fn sync_extra_build_dependencies() -> Result<()> {
let context = TestContext::new("3.12").with_filtered_counts();
// Write a test package that arbitrarily requires `anyio` at build time
let child = context.temp_dir.child("child");
child.create_dir_all()?;
let child_pyproject_toml = child.child("pyproject.toml");
child_pyproject_toml.write_str(indoc! {r#"
[project]
name = "child"
version = "0.1.0"
requires-python = ">=3.9"
[build-system]
requires = ["hatchling"]
backend-path = ["."]
build-backend = "build_backend"
"#})?;
let build_backend = child.child("build_backend.py");
build_backend.write_str(indoc! {r#"
import sys
from hatchling.build import *
try:
import anyio
except ModuleNotFoundError:
print("Missing `anyio` module", file=sys.stderr)
sys.exit(1)
"#})?;
child.child("src/child/__init__.py").touch()?;

@charliermarsh
Copy link
Member

I'm a little worried about the impact it will have on binary size, did you check a release build before and after?

@blueraft
Copy link
Contributor Author

did you check a release build before and after?

Not much of an increase, only 32kbs more

❯ du -sk uv_with_pipreqs
45240   uv_with_pipreqs
❯ du -sk uv_without_pepreqs
45208   uv_without_pepreqs

[tool.uv.extra-build-dependencies]
"anyio" = ["setuptools"]
or `uv pip install setuptools` into the environment and re-run with `--no-build-isolation`.
Copy link
Member

Choose a reason for hiding this comment

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

Fwiw this instruction isn't sufficient, because then they also need to install all of the other build dependencies of anyio. I'm hesitant to suggest it without that additional information (and broadly hesitant to suggest it at all).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I thought about this, but this matches the current hint we give for people facing issues with torch so I figured we shouldn't remove that.

Copy link
Member

Choose a reason for hiding this comment

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

I think now that we have the extra build dependencies it's actually okay to remove that, but... I'm okay with considering that separately. Can you open a tracking issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zanieb zanieb changed the title Add pipreqs module-to-package mapping for build time ModuleNotFoundError hints Add extra-build-dependencies hint for any missing module on build failure Aug 14, 2025
@zanieb zanieb merged commit e7b55fe into astral-sh:main Aug 14, 2025
117 of 153 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Aug 16, 2025
This MR contains the following updates:

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

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

[Compare Source](astral-sh/uv@0.8.10...0.8.11)

##### Python

- Add Python 3.14.0rc2
- Update Pyodide to 0.28.1

##### Enhancements

- Add Debian 13 trixie to published Docker images ([#&#8203;15269](astral-sh/uv#15269))
- Add `extra-build-dependencies` hint for any missing module on build failure ([#&#8203;15252](astral-sh/uv#15252))
- Make 'v' prefix cyan in overlap warnings ([#&#8203;15259](astral-sh/uv#15259))

##### Bug fixes

- Fix missing uv version in extended Docker image tags ([#&#8203;15263](astral-sh/uv#15263))
- Persist cache info when re-installing cached wheels ([#&#8203;15274](astral-sh/uv#15274))

##### Rust API

- Allow passing custom `reqwest` clients to `RegistryClient` ([#&#8203;15281](astral-sh/uv#15281))

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

[Compare Source](astral-sh/uv@0.8.9...0.8.10)

##### Python

- Add support for installing Pyodide versions ([#&#8203;14518](astral-sh/uv#14518))

##### Enhancements

- Allow Python requests with missing segments, e.g., just `aarch64` ([#&#8203;14399](astral-sh/uv#14399))

##### Preview

- Move warnings for conflicting modules into preview ([#&#8203;15253](astral-sh/uv#15253))

</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:eyJjcmVhdGVkSW5WZXIiOiI0MS42Ni4yIiwidXBkYXRlZEluVmVyIjoiNDEuNzEuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
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.

3 participants