Is there ongoing work or plan for integrating `uv`...
# general
h
Is there ongoing work or plan for integrating
uv
as an optional dependency resolver in Pants? I know there are feature requests for it, but was curious as to whether anybody has looked to pick it up. Faster resolution of environments would be a great improvement to have.
h
I am looking at this in the context of a new Python backend, it is basically the first feature that will be implemented
b
What's the status of the new Python backend? This seems relevant since there has been alot of pockets of thrash and it seems no one pocket is aware of the other. I know of Pim's work, some other convert uv lockfile -> Pex lockfile banditing and then there's all the Pex work that supports Pim (
--pylock
) and a whole other approach via
--venv-repository
. This question seems to be asked every month or so for the last >1 year and there is never a coherent response afaict.
h
I am performing a similar conversion of pex.lock -> uv.lock to add to the reference, but unhappy with that for the obvious reasons. IMO the slow dependency resolution that occurs with medium-and-up sized repos is the biggest hurdle by far currently in the Pants build system, but that’s just my view on it.
b
@hundreds-carpet-28072 out of curiosity, are you using https://github.com/pex-tool/pex/releases/tag/v2.64.0 yet? Although Pants really should be moving in some direction on faster resolves, I've been chipping away at what I can in the background to make Pex resolves faster. Pex >= 2.64 + Pip 25.3 yield some good results: https://github.com/pex-tool/pex/pull/2968#issuecomment-3451000127 This is not
uv
good, but it may make the wait for Pants action on this front more bearable.
d
I did a PoC on top of https://github.com/pantsbuild/pants/pull/22518 using the approach that John outlined in https://github.com/pantsbuild/pants/issues/20679#issuecomment-3462720148 Not sure if/when I'll be able to come back to it, so might as well share it. The code is mostly llm-authored, is missing tests (outside of the shell script), etc... but it does generate lockfiles and can be used to build and run pexes. a lockfile with pytorch generates in ~2 seconds as expected. https://github.com/pantsbuild/pants/compare/main...jcrobak:pants:uv-experiment?expand=1 One remaining item is cross-platform/environment support. IIUC, uv+pex can build (binary-only) cross platform pex's, so it might easier than running uv via a docker container/environment (which doesn't work in this branch). It probably warrants a design doc/written proposal.
h
@hundreds-carpet-28072 out of curiosity, are you using https://github.com/pex-tool/pex/releases/tag/v2.64.0 yet? Although Pants really should be moving in some direction on faster resolves, I’ve been chipping away at what I can in the background to make Pex resolves faster. Pex >= 2.64 + Pip 25.3 yield some good results: https://github.com/pex-tool/pex/pull/2968#issuecomment-3451000127 This is not
uv
good, but it may make the wait for Pants action on this front more bearable.
@brief-scientist-13682 I was aware of this and am planning to integrate this, but unfortunately we’re on quite an old version of Pants which doesn’t have support for that new a version of Pex being used. Our updates to Pants were delayed due to the new-to-us lockfile generation slowing down user workflows too much - for which we now have a hacky uv conversion solution, but now need to play catch up with newer versions.
b
Pex has full backwards compatibility.
Just a sec for links...
You can use those to use latest Pex and Pip on nearly all versions of Pants released over the last 3 years or so.
h
It would seem I’m mistaken! I could’ve sworn there was a stricter range of versions for the version of Pants we’re at, but I’m able to override it, actually. I’ll happily do some tests now with pex==2.66.0 and see what improvements I can get, thanks!!
b
You should just use latest Pex. And also Pip 25.3 is important.
195 Views