pdm icon indicating copy to clipboard operation
pdm copied to clipboard

Support uv as the resolver and installer

Open txchen opened this issue 11 months ago • 12 comments

Is your feature/enhancement proposal related to a problem? Please describe.

uv https://github.com/astral-sh/uv is extremely fast to install pip libs, it would be nice if pdm (install/sync) can optionally invoke uv instead of pip to make it faster.

Describe the solution you'd like

Add a pip backend option, and support uv.

### Tasks
- [ ] https://github.com/pdm-project/pdm/pull/2995
- [ ] Introduce uv as the installer

txchen avatar Mar 14 '24 22:03 txchen

There isn't pip in the backend.

We'll see if lockfile format can be standardized and only then we can consider uv.

frostming avatar Mar 15 '24 00:03 frostming

What does it mean to standardize a lock file?

ericjmorey avatar Mar 22 '24 03:03 ericjmorey

The community and packaging team is making effort on this: https://discuss.python.org/t/lock-files-again-but-this-time-w-sdists/46593

frostming avatar Mar 22 '24 05:03 frostming

Maybe a pdm-uv package/extension-- keep up the excellent work

Mjboothaus avatar Apr 10 '24 23:04 Mjboothaus

Maybe pdm could leverage just uv resolver. Like they mention in this blog post, it can be used only as a resolver with uv pip compile. The speed difference makes a really big difference in the day to day of a dev.

EtienneT avatar Jun 07 '24 11:06 EtienneT

Maybe pdm could leverage just uv resolver. Like they mention in this blog post, it can be used only as a resolver with uv pip compile. The speed difference makes a really big difference in the day to day of a dev.

The way uv resolver works in a different way from PDM's. You must specify the target Python version and platform tags to resolve against, while PDM supports resolving for a wide range of environments.

frostming avatar Jun 11 '24 00:06 frostming

I recently came up with a rough plan to leverage uv as the resolver and installer. However it would bring a significant change to how cross-platform lockfile works. And ideally it can also solve #46

I expect it to be a change of large scale and I am not sure if I can make it able to opt in and out. It also depends on how much spare time I can invest in this work, so no promise but stay tuned.

frostming avatar Jun 20 '24 09:06 frostming

The change will be divided into two steps. First, we will support resolving dependencies for the given target platform and Python range combination(#46 resolved at this step), and the current cross_platform strategy will be deprecated at the same time. Next, introduce uv to produce that lock. The workload ratio of these two steps is approximately 1:2. Therefore, we still need 2 or more minor releases for this to be landed.

frostming avatar Jun 28 '24 09:06 frostming

@frostming By deprecating cross_platform strategy, do you mean that the lock files aren't cross platform anymore?

o-moe avatar Jun 28 '24 13:06 o-moe

@frostming By deprecating cross_platform strategy, do you mean that the lock files aren't cross platform anymore?

Not by the way it is now. You must specify which platform and python range the lockfile is targeted. You can also specify several combinations(or matrix) in a single lockfile.

This will make it more smooth to move to the lockfile standard in the future(if it's gonna be a thing). Because from the discussions happened till now, the community is tend to adopt this approach.

frostming avatar Jun 28 '24 13:06 frostming

@frostming Hi, I just read a tweet https://x.com/bentomlai/status/1815380726482932107. I would like to know how the uv is used. Is it integrated into PDM or used as a standalone CLI?

zhuwenxing avatar Jul 23 '24 06:07 zhuwenxing

@zhuwenxing This PR is not related to PDM tool itself. src/openllm/venv.py

ipfans avatar Aug 03 '24 04:08 ipfans

An experimental uv integration has landed in the latest prerelease of PDM. Or you can try the in-development branch at #3144

frostming avatar Sep 06 '24 07:09 frostming

An experimental uv integration has landed in the latest prerelease of PDM. Or you can try the in-development branch at #3144实验性的 uv 集成已出现在最新的 PDM预发行版中。或者您可以尝试开发中的分支 #3144

*请问老哥什么时候发布到正式版当中, 现在的解析速度确实过于缓慢, 未来如果用rust或者go重写也是可以考虑 ,还有现在的init template 也不太完善

Super1Windcloud avatar Sep 14 '24 01:09 Super1Windcloud

An experimental uv integration has landed in the latest prerelease of PDM. Or you can try the in-development branch at #3144

looks like #3144 is merged and released. Does that mean this issue is resolved?

prassanna-ravishankar avatar Sep 30 '24 16:09 prassanna-ravishankar