Skip to content

Conversation

@mayeut
Copy link
Member

@mayeut mayeut commented Dec 14, 2025

This PR changes the way uv is used in cibuildwheel for direct invocations.
At the moment, there's a mixed usage of direct invocations (assumed in PATH) & find_uv() path invocations.
#2690 has been opened to always use find_uv() but this is not really compatible with build unless it's installed with the uv extra.
In order not to install build's uv extra, find_uv is updated to symlink/copy uv in a temporary directory. This temporary directory is added to build/test virtual environments PATH which removes the need to install build's uv extra when using cibuildwheel's uv extra.

close #2690
close #2673

@mayeut mayeut requested a review from mhsmith as a code owner December 14, 2025 18:43
@mayeut mayeut mentioned this pull request Dec 14, 2025
Copy link
Member

@mhsmith mhsmith left a comment

Choose a reason for hiding this comment

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

The Android change looks OK to me, but I don't know enough to comment on the larger question of this PR vs #2690.

@henryiii
Copy link
Contributor

Build should behave similarly, using a uv in the path if there's no uv package installed?

https://github.com/pypa/build/blob/ed9c379f51abca7c0c0ae20bee66aa548d597dc3/src/build/env.py#L305-L307

@henryiii henryiii mentioned this pull request Dec 16, 2025
@mayeut
Copy link
Member Author

mayeut commented Dec 16, 2025

Build should behave similarly, using a uv in the path if there's no uv package installed?

If cibuildwheel's uv extra is not exposed in the PATH (as proposed in #2673) then build won't find uv unless it was installed with its own uv extra. See https://github.com/mayeut/cibuildwheel/actions/runs/20258197705/job/58164557217 for a failure when #2673 is applied on Windows which does not install build's uv extra.

I see you opened an issue in build and that's probably a good thing which should be applied ecosystem wide and would allow for an easier resolution.

@joerick
Copy link
Contributor

joerick commented Dec 19, 2025

Hmm. All this is starting to feel a little messy/hacky. I'm thinking there's another option here, where we say that if the build-frontend uses uv, we require the caller of cibuildwheel to ensure that uv is somewhere on PATH (and bail if it's not found). So, we don't even attempt to look in the python import path for it. That way we'll be sure that build can use it too.

In the case of the github action, we could just use astral/setup-uv conditionally, and keep the direct invocation there?

As I see it, the cibuildwheel[uv] extra would continue to work in this setup, assuming that users have the virtualenv active when they call cibuildwheel (this must be the most common setup, I'd expect).

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