While neat, doesn't it also comes with certain issues?
Startup times has to be slower, but probably only for the first run?
There's a some level of violation of the "Principle Of Least Surprise", depending on the setting. For some it will be the reverse, the script they got just works, without any setup or package installation. For others we'll wonder why it just started downloading a bunch of packages we already have.
Probably not the greatest idea for production environments, where you should not or can not just pull in packages from the internet.
It's really cool that it works, but I think I'd recommended using it highly selectively.
The problem with that is that eventually too many scripts means you will hit incompatibilities in Python where you can only install one version of a lib in each venv.
This trick is perfect because:
- From now on, I always install uv on all my machines anyway.
- After the first run, not only the cache make it fast, but it uses hard links so that you don't even pay the of multiple install on disk space (that's also how they are so fast in creating the envs, that and some interesting HTTP/zip tricks: https://www.bitecode.dev/p/charlie-marsh-on-astral-uv-and-th...).
- Deps are clearly defined in the script, so it's self-documenting.
For prod, shiv (https://shiv.readthedocs.io/) is probably your best bet but I'm betting uv will come up with a version of that soon.
I'd read it! :) I want to understand Shiv, but I haven't even gotten it to work after a few hours tinkering, and that's usually where I give up and look to another tool.
If you benchmark that you'll find uv spends microseconds getting the virtual environment up and running - that's its USP, they've invested a huge amount of work and ingenuity into making virtual environments so fast to create that you no longer have to think about that.
Startup times has to be slower, but probably only for the first run?
There's a some level of violation of the "Principle Of Least Surprise", depending on the setting. For some it will be the reverse, the script they got just works, without any setup or package installation. For others we'll wonder why it just started downloading a bunch of packages we already have.
Probably not the greatest idea for production environments, where you should not or can not just pull in packages from the internet.
It's really cool that it works, but I think I'd recommended using it highly selectively.