Live data from Hacker News

Uv saves Home Assistant 215 compute hours per month

developers.home-assistant.io

51–60 of 60 posts

Re: Uv saves Home Assistant 215 compute hours per month

#51
post #8

Would the authors not have been better off adding their performance improvements to pip rather than creating their own tool? I remember this being a complaint from Node maintainers when Bun was released: they had multiple open performance-related issues with no one available to work on them.

uv isn't a performance improvement on pip but a ground-up rewrite in a completely different language.

both can be true.

Re: Uv saves Home Assistant 215 compute hours per month

#52
post #26

Earlier quoted context omitted.

Yeah but I suspect there’s something more going on than Rust magic. They’re claiming a savings of about an hour and a half. (4% of the original time) That sounds like an architecture change, or more likely a whole lot of caching.

If the first step of your build process is creating a new pip venv from scratch, it's entirely believable to me. Pip resolves packages sequentially, so there's a lot of low hanging fruit even without yoinking a state of the art constraint solver. As a concrete example, I have a raspberry pi 4 I use for "what's the most pathetic hardware a user might try". It takes 5-10 minutes to build up a fresh venv even when it ha…

Is that on a SD card? My expectation is that SD cards are garbage and any number of IO access patterns break down vs a SSD.

Re: Uv saves Home Assistant 215 compute hours per month

#53

Earlier quoted context omitted.

Rust, the language, has rather successfully worked towards and demonstrated that, in many areas, you CAN have your pie and eat it too. But that doesn't carry over to applications, where it must be demonstrated again.

I’m doubtful the fact that uv is written in rust is directly responsible for the speed increase, it’s probably just a better dependency determination algorthm. Stop talking about fancy pies, you don’t need it even if it smells nice. What you actually need is to eat healthy and nutritious foods.

Having done a fair amount of rust porting I imagine it’s a mix a both. Rust really is remarkably faster than Python at everything. But these results are indicative of a better algorithm as well.

Re: Uv saves Home Assistant 215 compute hours per month

#54
post #4

Earlier quoted context omitted.

I’m guessing “rewrite it in Rust” would have been an unpalatable PR for the pip maintainers to merge.

Yeah but I suspect there’s something more going on than Rust magic. They’re claiming a savings of about an hour and a half. (4% of the original time) That sounds like an architecture change, or more likely a whole lot of caching.

Converting python code to rust for data processing can get you 20x perf increase (single threaded).

Re: Uv saves Home Assistant 215 compute hours per month

#55

I'm going to ask a stupid question, but why not just keep the packages installed?

I've spent an embarrassing amount of time trying to figure out why Docker refuses to use my cached layers 80-90% of the time, even though every dependency is properly pinned and build commands properly ordered. I said f-it, gave up and replaced pip with uv. It's nowhere near the speed of a cached build but it's a free 3 minutes.

Re: Uv saves Home Assistant 215 compute hours per month

#56
post #26

Earlier quoted context omitted.

If the first step of your build process is creating a new pip venv from scratch, it's entirely believable to me. Pip resolves packages sequentially, so there's a lot of low hanging fruit even without yoinking a state of the art constraint solver. As a concrete example, I have a raspberry pi 4 I use for "what's the most pathetic hardware a user might try". It takes 5-10 minutes to build up a fresh venv even when it ha…

Is that on a SD card? My expectation is that SD cards are garbage and any number of IO access patterns break down vs a SSD.

I threw in a moderately fast USB drive (~90 mb/s after pi4 overhead) because I got sick of SD cards dying every 6-12 months. Pi4 is very speed limited. Even if you tried to use an ssd, I think the highest I've seen is around 250mb/s with an nvme drive that gets a few gb/s in a real computer. In theory it should get to like 500mb/s for sata limits.

Re: Uv saves Home Assistant 215 compute hours per month

#58

I guess I don't have enough context to really understand this. It takes 1.5 hours to calculate what dependencies Home Assistant needs? Wouldn't you normally amortize that out for each top-level dependency you add to the project and write it to a lock file or something, so that builds just become fetching the relevant artifacts? Even then, I'm not sure how it would take 1.5 hours even on pen and paper.

> Wouldn't you normally amortize that out for each top-level dependency you add to the project and write it to a lock file or something

Plain pip doesn't really have a lockfile. You can generate a freeze file, but that's something different in practice.

I haven't really been in the Python ecosystem in several years, but my surprise was mostly how there was no mention of Poetry or pipenv. Didn't they address that need before? Are they already out of favor?

Re: Uv saves Home Assistant 215 compute hours per month

#59
The comments here betray a significant misunderstanding of both the Python ecosystem and open source work.

Getting to a consensus is hard work. They have a vision for how Python packaging and tooling could be better (I assume cargo-like), and a roadmap for improving that. They could have tried to convince the pip maintainers their roadmap was best, but with large fragmented communities like Python it is impossible to reason about how the community will receive changes to tooling. It’s better to build something and get feedback to prove the hypothesis.

The choice of Rust is just because they like the developer ergonomics in that language (I suspect a big reason is that they wanted to ship a single binary independent of any Python env). CPython is written in C because… Guido started to write it in C.

Many comments here don’t understand that their competitors are actually NOT just pip but the conda ecosystem including micromamba (written in C++) which does not attempt to maintain pip interop at all. Conda realized that there are millions of Python programmers who are not developers and could not debug a GCC error message when pip installing scipy.

There are thousands of Python packages that are basically tested on whatever version of Python and libraries the author had installed at the time they wrote it, and literally millions of Github issues that are something like “this doesn’t work because I installed version Y of package X and package Z requires If you haven’t lost days of work to solving stupid dependency issues in Python I’m not sure you can relate.

Re: Uv saves Home Assistant 215 compute hours per month

#60
post #58

I guess I don't have enough context to really understand this. It takes 1.5 hours to calculate what dependencies Home Assistant needs? Wouldn't you normally amortize that out for each top-level dependency you add to the project and write it to a lock file or something, so that builds just become fetching the relevant artifacts? Even then, I'm not sure how it would take 1.5 hours even on pen and paper.

> Wouldn't you normally amortize that out for each top-level dependency you add to the project and write it to a lock file or something Plain pip doesn't really have a lockfile. You can generate a freeze file, but that's something different in practice. I haven't really been in the Python ecosystem in several years, but my surprise was mostly how there was no mention of Poetry or pipenv. Didn't they address that need…

I don't think this is anything like poetry. The dependency resolution doesnt seem to handle much variation in arch or Python version or other variables I at least have to deal with. I generally use poetry for dependency management (only runs in dev) then use pip or venv-update to install in prod from a generated requirements.txt.

uv looks like a good and fast replacement for pip or venv-update but those only take a fraction of a second to run (on a noop, my main use case) so I personally haven't seen where uv would fit in my workflow yet. Maybe building in containers from scratch each time, though again pip is performant enough for me when not doing the hard work of dependency resolution, and for some reason it's not cached.

I am not sure why dependency resolution outside of dev or build systems would be done. But maybe I have escaped the loop.

Post reply on HN