News for hackers. Stuff that matters.
Re:Uv's killer feature is pulling in local dependencies by zahlman on Sunday January 12, 2025 @10:24PM (#42679766)
I still don't understand why people want separate tooling to "handle the Python executable". All you need to do is have one base installation of each version you want, and then make your venv by running the standard library venv for that Python (e.g. `python3.x -m venv .venv`).
Re:Uv's killer feature is pulling in local dependencies by gtaylor on Sunday January 12, 2025 @10:40PM (#42679854)
I'm glad to let uv handle that for me. It does a pretty good job at it!
Re:Uv's killer feature is pulling in local dependencies by stavros on Sunday January 12, 2025 @10:25PM (#42679773)
> All you need to do is have one base installation of each version you want

Because of this ^

Re:Uv's killer feature is pulling in local dependencies by zahlman on Monday January 13, 2025 @12:02AM (#42680236)
But any tool you use for the task would do that anyway (or set them up temporarily and throw them away). Python on Windows has a standard Windows-friendly installer, and compiling from source on Linux is the standard few calls to `./configure` and `make` that you'd have with anything else; it runs quite smoothly and you only have to do it once.
Re:Uv's killer feature is pulling in local dependencies by _ZeD_ on Monday January 13, 2025 @12:11AM (#42680274)
I need to tell you a secret... I'm a long-life Linux user (since mandrake!)

Also, I don't have a c compiler installed.

Re:Uv's killer feature is pulling in local dependencies by zahlman on Monday January 13, 2025 @12:32AM (#42680364)
Really? I was told Mint was supposed to be the kiddie-pool version of Linux, but it gave me GCC and a bunch of common dependencies anyway.

(By my understanding, `pyenv install` will expect to be able to run a compiler to build a downloaded Python source tarball. Uv uses prebuilt versions from https://github.com/astral-sh/python-build-standalone ; there is work being done in the Python community on a standard for packaging such builds, similarly to wheels, so that you can just use that instead of compiling it yourself. But Python comes out of an old culture where users expect to do that sort of thing.)

Re:Uv's killer feature is pulling in local dependencies by chupasaurus on Monday January 13, 2025 @07:23AM (#42682695)
In Debian build-essential package is only recommended dependency of pip. Pyenv obviously wouldn't work without it.
Re:Uv's killer feature is pulling in local dependencies by nicoburns on Monday January 13, 2025 @12:56AM (#42680491)
Having to manually install python versions and create venvs is pretty painful compared to say the Rust tooling where you install rustup once, and then it will automatically choose the correct Rust version for each project based on what that project has configured.

UV seems like it provides a lot of that convenience for python.

Re:Uv's killer feature is pulling in local dependencies by rat87 on Monday January 13, 2025 @02:06PM (#42687283)
Lots of reasons starting. You may want many people to have the same point release. They have early builds without needing to compile it from source and have free threading (mogul) builds. I think they might even have pro builds. Not to mention that not all district releases will have the right python release. Also people want the same tool to handle both python version and venv creation and requirement installation
Re:Uv's killer feature is pulling in local dependencies by zahlman on Monday January 13, 2025 @09:28PM (#42692744)
>Also people want the same tool to handle both python version and venv creation and requirement installation

This is the part I don't understand. Why should it be the same tool? What advantage does that give over having separate tools?

Re:Uv's killer feature is pulling in local dependencies by rat87 on Tuesday January 14, 2025 @01:05AM (#42694240)
Because its easier. Because it fits together nicer and more consistently. Also because UV is well written and written in rust so all the parts are fast. You can recreate a venv from scratch for every run.

Also as silly as it is I actually have a hard time remembering the venv syntax each time.

uv run after a checkout with a lock file and a .python-version file downloads the right python version creates a venv and then installs the packages. No more needing throwaway venvs to get a clean pip freeze for requirements. And I don't want to compile python, even with something helping me compile and keep track of compiles like pyenv a lot can go wrong.

And that assumes an individualindividual project run by someone who understands python packaging. UV run possibly in a wrapper script will do those things for my team who doesn't get packaging as well as I do. Just check in changes and next time they UV run it updates stuff for them

Re:Uv's killer feature is pulling in local dependencies by zahlman on Tuesday January 14, 2025 @01:58AM (#42694540)
I guess I will never really understand the aesthetic preferences of the majority. But.

>Because its easier. Because it fits together nicer and more consistently. Also because UV is well written and written in rust so all the parts are fast. You can recreate a venv from scratch for every run.

This is the biggest thing I try to push back on whenever uv comes up. There is good evidence that "written in Rust" has quite little to do with the performance, at least when it comes to creating a venv.

On my 10-year-old machine, creating a venv directly with the standard library venv module takes about 0.05 seconds. What takes 3.2 more seconds on top of that is bootstrapping Pip into it.

Which is strange, in that using Pip to install Pip into an empty venv only takes about 1.7 seconds.

Which is still strange, in that using Pip's internal package-installation logic (which one of the devs factored out as a separate project) to unpack and copy the files to the right places, make the script wrappers etc. takes only about 0.2 seconds, and pre-compiling the Python code to .pyc with the standard library `compileall` module takes only about 0.9 seconds more.

The bottleneck for `compileall`, as far as I can tell, is still the actual bytecode compilation - which is implemented in C. I don't know if uv implemented its own bytecode compilation or just skips it, but it's not going to beat that.

Of course, well thought-out caching would mean it can just copy the .pyc files (or hard-link etc.) from cache when repeatedly using a package in multiple environments.