Skip to content

Switch cibuildwheel to the uv build frontend#234

Merged
bdraco merged 4 commits into
masterfrom
cibuildwheel-uv
May 17, 2026
Merged

Switch cibuildwheel to the uv build frontend#234
bdraco merged 4 commits into
masterfrom
cibuildwheel-uv

Conversation

@bdraco

@bdraco bdraco commented May 17, 2026

Copy link
Copy Markdown
Member

What do these changes do?

Set build-frontend = "build[uv]" in
[tool.cibuildwheel] so that uv provisions every virtual
environment cibuildwheel creates, both on the build side (passed
to python -m build as --installer=uv) and when
materializing the per-ABI test environment. The previous
build-frontend = "build" left every test env doing a
multi-second pip resolve of requirements/test.txt per ABI;
uv resolves and installs the same set in roughly a second,
which compounds across the seven ABIs and four host platforms in
the wheel matrix.

Also adds frontend to docs/spelling_wordlist.txt so the
news fragment passes the docs spell check.

Are there changes in behavior for the user?

No, contributor tooling only.

Related issue number

N/A

Checklist

  • I think the code is well written
  • Unit tests for the changes exist: N/A (CI-only change; the wheel-matrix run on this PR is the verification path)
  • Documentation reflects the changes: N/A (no user-visible API change)
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt: N/A (no such file in this repo)
  • Add a new news fragment into the CHANGES/ folder (CHANGES/234.contrib.rst)

Drafted with Claude Code (Opus 4.7); reviewed by @bdraco.

Agent run details (optional, for reviewers)

Local validation:

```
$ python3 -c "import tomllib; tomllib.load(open('pyproject.toml','rb'))"
$ make doc-spelling
2 pre-existing misspellings only ("subdirectory" in CHANGES/207.contrib.rst, "postfix" in CHANGES.rst); CHANGES/234.contrib.rst is clean after adding "frontend" to the wordlist.
$ SKIP=actionlint-docker pre-commit run --all-files
all hooks pass (actionlint-docker skipped: Docker daemon not running locally; runs in CI).
```

Not verified locally: the actual cibuildwheel + uv interaction
inside the build container; that requires running cibuildwheel
which is impractical without pushing. The live CI run on this
branch is the verification. Existing PIP_CONSTRAINT in
[tool.cibuildwheel.environment] is left in place; uv ignores
it (uv reads UV_CONSTRAINT / UV_BUILD_CONSTRAINT), and if
the wheel build ends up needing the Cython pin to apply during
uv-driven build dependency resolution, a follow-up can add a
parallel UV_BUILD_CONSTRAINT entry. The before-test
PyYAML pre-cache ("PIP_CONSTRAINT= pip install PyYAML") was
also left untouched; it becomes a no-op under uv but is harmless
and removing it is out of scope for this PR.

Independent of and stacks naturally with #233 (ccache wrapping
for the C compile); the two PRs touch different cibuildwheel
config sections and different workflow steps.

bdraco added 2 commits May 17, 2026 12:40
Setting `build-frontend = "build[uv]"` makes cibuildwheel use uv
for every virtual environment it provisions, both on the build
side (passed to `python -m build` as `--installer=uv`) and when
materializing the test environment. Test-dependency installs in
the wheel matrix drop from a multi-second pip resolve per ABI to
roughly a sub-second uv resolve, which compounds across the seven
ABIs and four host platforms.
@psf-chronographer psf-chronographer Bot added the bot:chronographer:provided There is a change note present in this PR label May 17, 2026
bdraco added 2 commits May 17, 2026 12:52
uv venvs do not ship pip, so the inherited
``"PIP_CONSTRAINT= pip install PyYAML"`` before-test step fails
on macOS and Linux with ``pip: command not found``. The
workaround (pypa/cibuildwheel#1666) was specific to pip's build
isolation propagating ``PIP_CONSTRAINT`` to PyYAML's source
build; uv handles build constraints through a different env var
(``UV_BUILD_CONSTRAINT``) that is not set here, so the original
conflict does not arise and the pre-cache is unnecessary. Drop
the workaround and the now-empty Windows override that existed
only to neutralize the same hook on cmd.
@bdraco bdraco marked this pull request as ready for review May 17, 2026 20:06
@bdraco

bdraco commented May 17, 2026

Copy link
Copy Markdown
Member Author

major improvement. just scrolls by now. will apply broadly

@codspeed-hq

codspeed-hq Bot commented May 17, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 4 untouched benchmarks


Comparing cibuildwheel-uv (1430bc4) with master (6093ed1)

Open in CodSpeed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided There is a change note present in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant