Hacker News new | ask | show | jobs
by bsdz 462 days ago
I feel for me, at least one nice thing about poetry over uv is, that if I have an issue or feature extension, I can just write my own plugin in pure Python. With uv, I'd need to learn Rust in addition to python/c/c++/etc.

I wonder what it would take to get poetry on par with uv for those who are already switching to it? Poetry is definitely very slow downloading multiple versions of packages to determine dependencies (not sure how uv works around this?). Does uv have a better dependency checker algorithm?

4 comments

In this day and age you don't usually have to download the packages to resolve the dependencies as PyPI can usually expose it (unless you need to install from sdist which is less common these days).

Dependency resolution is slow because it's computationally very expensive. Because uv is written in Rust the resolution is just much much faster. IIRC they actually reuse the same resolution package that Cargo (Rust's package manager) uses.

Yes I think I heard pypi started exposing dependency info so it makes sense to use that where possible.

The dependency resolution computation is an interesting problem. I think poetry at some point switched to mypyc for compilation (although I can't find conclusive evidence for it now). From my experience, mypyc doesn't really improve performance much compared to say writing a c/c++ extension. Perhaps offloading dependency resolution in poetry to a native c library is a way to match uv.

> I wonder what it would take to get poetry on par with uv

Different laws of physics, to start with.

I wonder what it would take to get poetry on par with uv for those who are already switching to it?

Poetry and uv have quite different philosophy. Poetry is incredibly opinionated in how you should do things, and trying to make poetry fit an existing project or combining poetry with other tools is quite likely to break. Uv on the hand is far more flexible and easier to make work with your current workflow. For me that was the main reason I gave up poetry, and in that aspect poetry will probably never be 'on par' with uv since these aren't technical differences, but differences of philosophy.

Curious what you found too opinionated about Poetry (not saying it doesn't happen)
The way it assumes one and exactly one venv per project was a big one. The one that broke me however was trying to get it work with external build systems, specifically trying to compile C++ code as part of the build process. Another important one was that it doesn't play nicely with older code built on pip and pip based workflows. You basically have to start from scratch, while uv makes it much easier to slowly transition.
For me personally the killer uv feature is pyenv integration, which poetry doesn't do
Interesting - thanks. I use virtual environments and each has its own python version tied to it. Not sure if pyenv is useful to me but who knows perhaps one day. Good to know uv supports pyenv.