Live data from Hacker News

Uv's killer feature is making ad-hoc environments easy

valatka.dev

81–90 of 428 posts

Re: Uv's killer feature is making ad-hoc environments easy

#81
post #12

I really like uv, and it's the first package manager for a while where I haven't felt like it's a minor improvement on what I'm using but ultimately something better will come out a year or two later. I'd love if we standardized on it as a community as the de facto default, especially for new folks coming in. I personally now recommend it to nearly everyone, instead of the "welllll I use poetry but pyenv works or you…

I never used anything other than pip. I never felt the need to use anything other than pip (with virtualenv). Am I missing anything?

Performance and correctness mostly.

Re: Uv's killer feature is making ad-hoc environments easy

#82
post #26

As a NodeJS developer it's still kind of shocking to me that Python still hasn't resolved this mess. Node isn't perfect, and dealing with different versions of Node is annoying, but at least there's none of this "worry about modifying global environment" stuff.

I wouldn't really say it's that black and white. It was only recently that many large libraries and tools recommended starting with "npm i -g ...". Of course you could avoid it if you knew better, but the same is true for Python.

Re: Uv's killer feature is making ad-hoc environments easy

#83

Earlier quoted context omitted.

pip's resolving algorithm is not sound. If your Python projects are really simple it seems to work but as your projects get more complex the failure rate creeps up over time. You might pip install something and have it fail and then go back to zero and restart and have it work but at some point that will fail. conda has a correct resolving algorithm but the packages are out of date and add about as many quality probl…

May I introduce you to our lord and saviour, Nix and it's most holy child nixpkgs! With only a small tithing of your sanity and ability to Interop with any other dependency management you can free yourself of all dependency woes forever ! [ ] For various broad* definitions of forever. [*] Like, really, really broad** [**] Maybe a week if you're lucky

The Nix of Python, conda, was already mentioned.

> add about as many quality problems as they fix

Re: Uv's killer feature is making ad-hoc environments easy

#85
post #3

Uv also bundles uvx command so you can run Python scripts without installing them manually: uvx --from 'huggingface_hub[cli]' huggingface-cli

And there's also the `uv run script.py` where you can have dependencies indicated as comments in the script, see eg https://simonwillison.net/2024/Dec/19/one-shot-python-tools/

Re: Uv's killer feature is making ad-hoc environments easy

#86
Whats the point if you have other binary dependencies?

Use Nix for Python version as well as other bin deps, and virtualenv + pip-tools for correct package dependency resolution.

Waiting 4s for pip-tools instead of 1ms for uv doesn't change much if you only run it once a month.

Re: Uv's killer feature is making ad-hoc environments easy

#87
post #26

As a NodeJS developer it's still kind of shocking to me that Python still hasn't resolved this mess. Node isn't perfect, and dealing with different versions of Node is annoying, but at least there's none of this "worry about modifying global environment" stuff.

Half the time something breaks in a javascript repo or project, every single damn javascript expert in the team/company tells me to troubleshoot using the below sequence, as if throwing spaghetti on a wall with no idea what's wrong.

Run npm install

Delete node_modules and wait 30minutes because it takes forever to delete 500MB worth of 2 million files.

Do an npm install again (or yarn install or that third one that popped up recently?)

Uninstall/Upgrade npm (or is it Node? No wait, npx I think. Oh well, used to be node + npm, now it's something different.)

Then do steps 1 to 3 again, just in case.

Hmm, maybe it's the lockfile? Delete it, one of the juniors pushed their version to the repo without compiling maybe. (Someone forgot to add it to the gitignore file?)

Okay, do steps 1 to 3 again, that might have fixed it.

If you've gotten here, you are royally screwed and should try the next javascript expert, he might have seen your error before.

So no, I'm a bit snarky here, but the JS ecosystem is a clustermess of chaos and should rather fix it's own stuff first. I have none of the above issues with python, a proper IDE and out of the box pip.

Re: Uv's killer feature is making ad-hoc environments easy

#88
post #61
post #20

Earlier quoted context omitted.

There’s a shebang now. as of PEP 722 you can declare dependencies in a comment at the top of a single file script that a package manager can choose to read and resolve. uv has support for it: https://docs.astral.sh/uv/guides/scripts/#running-a-script-w... (which only helps if your team is all in on uv, but maybe they are)

How does that work with the shebang?

Check eg https://simonwillison.net/2024/Dec/19/one-shot-python-tools/

Re: Uv's killer feature is making ad-hoc environments easy

#89

Earlier quoted context omitted.

I never used anything other than pip. I never felt the need to use anything other than pip (with virtualenv). Am I missing anything?

pip's resolving algorithm is not sound. If your Python projects are really simple it seems to work but as your projects get more complex the failure rate creeps up over time. You might pip install something and have it fail and then go back to zero and restart and have it work but at some point that will fail. conda has a correct resolving algorithm but the packages are out of date and add about as many quality probl…

Ugh, I hate writing this but that's where docker and microservices comes to the rescue. It's a pain in the butt and inefficient to run but if you don't care about the overhead (and if you do care, why are you still using Python?), it works.

Re: Uv's killer feature is making ad-hoc environments easy

#90
post #64

Earlier quoted context omitted.

Oh come on, it's not that hard even for packaging stuff (let alone usage). Quite trivial compared to leetcode grind I'd say.

Everybody will reinvent Nix if they are in software engineering long enough ...

If only... Majority will use whatever is shoved up their a## be it docker or anything else.
Post reply on HN