6 ms·
Oh wow, it actually can handle the Python executable? I didn't know that, that's great! Although it's in the article as well, it didn't click until you said it,
by stavros 2y ago
Oh wow, it actually can handle the Python executable? I didn't know that, that's great! Although it's in the article as well, it didn't click until you said it, thanks!
- zahlman 2y agoI 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`).
- stavros 2y ago> All you need to do is have one base installation of each version you want Because of this ^
- zahlman 2y agoBut 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.
- _ZeD_ 2y agoI need to tell you a secret... I'm a long-life Linux user (since mandrake!) Also, I don't have a c compiler installed.
- zahlman 2y agoReally? 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 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.)
- chupasaurus 2y agoIn Debian build-essential package is only recommended dependency of pip. Pyenv obviously wouldn't work without it.
- gtaylor 2y agoI'm glad to let uv handle that for me. It does a pretty good job at it!
- nicoburns 2y agoHaving 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.
- rat87 2y agoLots 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
- zahlman 2y ago>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?
- rat87 2y agoBecause 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
- zahlman 2y agoI 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.
- meitham 2y agoI would avoid using this feature! It downloads a compiled portable python binary from some random github project not from PSF. That very same github project recommends against using their binary as the compilation flags is set for portability against performance. See https://gregoryszorc.com/docs/python-build-standalone/main/ https://gregoryszorc.com/docs/python-build-standalone/main/
- mkl 2y agohttps://github.com/astral-sh/python-build-standalone https://github.com/astral-sh/python-build-standalone is by the same people as uv, so it's hardly random. The releases there include ones with profile-guided optimisation and link time optimisation [1], which are used by default for some platforms and Python versions (and work seems underway to make them usable for all [2]). I don't see any recommendation against using their binaries or mention of optimising for portability at the cost of performance on the page you link or the pages linked from it that I've looked at. [1] https://github.com/astral-sh/uv/blob/main/crates/uv-python/download-metadata.json https://github.com/astral-sh/uv/blob/main/crates/uv-python/d... (search for pgo) [2] https://github.com/astral-sh/uv/issues/8015 https://github.com/astral-sh/uv/issues/8015
- meitham 2y agoThis must have moved recently! I looked at this around end of December and it was hosted on https://github.com/indygreg/python-build-standalone/releases https://github.com/indygreg/python-build-standalone/releases which had nothing to do with UV. If you read through the docs now it still references indygreg and still shows this https://github.com/indygreg/python-build-standalone https://github.com/indygreg/python-build-standalone so I guess the move has not completed it, but yes it's a positive change to see UV taking ownership of the builds.
- mwarkentin 2y agoDetails here: - https://gregoryszorc.com/blog/2024/12/03/transferring-python-build-standalone-stewardship-to-astral/ https://gregoryszorc.com/blog/2024/12/03/transferring-python... - https://astral.sh/blog/python-build-standalone https://astral.sh/blog/python-build-standalone