Fix uv PEX builder to use pex3 lock export#23227
Fix uv PEX builder to use pex3 lock export#23227seungwoo-ji-03 wants to merge 6 commits intopantsbuild:mainfrom
Conversation
|
Chose
(Based on reading |
jsirois
left a comment
There was a problem hiding this comment.
@seungwoo-ji-03 this looks good to me, but a few notes - the 2nd - the existence of pex3 lock export-subset, may prove useful at some point.
benjyw
left a comment
There was a problem hiding this comment.
The fix is fine, but the new tests aren't testing much - everything interesting is mocked out. Better to add some URL requirements to some existing tests, and/or create new ones that work the same way (via rule_runner.request() and/or the create_pex_and_* helpers).
| explicit requirement strings and a local Python interpreter; other builds silently fall back to pip. | ||
| See [#20679](https://github.com/pantsbuild/pants/issues/20679) for background. | ||
|
|
||
| The experimental uv PEX builder (`[python].pex_builder = "uv"`) now correctly handles VCS |
There was a problem hiding this comment.
There is no need to call out a bugfix in a feature that hasn't been released yet (there has been no 2.32.0 stable yet). From the user perspective this bug was never in the wild. So you can revert this.
When the uv PEX builder extracts pinned requirements from a PEX-native lockfile, it previously parsed the internal JSON format directly. This broke VCS and direct URL requirements (formatted as name==version instead of name @ url), and the PEX maintainer has warned that this internal format is unsupported and may change without notice.
This PR replaces JSON parsing with pex3 lock export --format pep-751 via PexCliProcess. The exported pylock.toml is passed directly to uv pip install -r, handling VCS refs, direct URLs, extras, and platform filtering out of the box.
Follow-up to #23197 (reported by @benjyw, approach suggested by @jsirois).
Supersedes #23218.