Live data from Hacker News

Uv is the best thing to happen to the Python ecosystem in a decade

emily.space

871–880 of 1001 posts

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#871

The sticking point for me is the way tools like uv and poetry build everything around the idea of a "project". I don't want a separate environment for every project, and I don't want to start by creating a project. I want to start with an environment that has stuff in it, and I start fiddling around, and gradually something comes together that eventually will be pulled out into a separate project. From what I can see…

I have the same feeling, so I just looked it up and actually uv does support exactly that mode. It works the same as venv and pip but you just prefix a bunch of commands with "uv". Create a new virtual environment fooenv:

   uv venv fooenv
Activate virtual environment on Windows (yes I'm sorry that's what I'm currently typing on!):

   .\fooenv\Scripts\activate
Run some environment commands:

   uv pip install numpy
   uv pip freeze
   uv pip uninstall numpy
If you run python now, it will be in this virtual environment. You can deactivate it with:

   deactivate
Admittedly, there doesn't seem to be much benefit compared to traditional venv/pip for this use case.

This is covered in the section of the docs titled "The pip interface": https://docs.astral.sh/uv/pip/

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#872

I predict it'll be the best and then the 'worst' thing: they'll go hard on monetisation. Just look at this post: 1839 points and 1048 comments! That is insane. It's captured the hearts and minds of Python devs and I'm sure they know it. I'm not against projects making money, just remember you'll likely pay a price later on once you invest in more of Astral's ecosystem. It's just temporarily free.

It is open source. If they enshitify UV with monetization, it will be forked.

Yes, but only after fracturing the ecosystem even further unfortunately.

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#873
I have to say that I am extremely reluctant to switch over to yet another python management system (packaging, environment, python version). Every few years someone says: this is it. Switch to poetry! Okay, I did. And, at least for some academic packages, psychopy I'm looking at you, it was a friggin disaster.

so. will uv install psychopy (say version 3.2.4)?

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#874

I have to say that I am extremely reluctant to switch over to yet another python management system (packaging, environment, python version). Every few years someone says: this is it. Switch to poetry! Okay, I did. And, at least for some academic packages, psychopy I'm looking at you, it was a friggin disaster. so. will uv install psychopy (say version 3.2.4)?

This is it. Switch to uv!

This time for real!

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#875
UV lets me love using Python. There are other languages, mostly Lisp languages, that I have always liked better but my workflow with UV is so pleasant that I find myself not minding Python the language, even looking forward to using it.

General comment: using Rust for utilities and libraries has revitalized Python.

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#876

The sticking point for me is the way tools like uv and poetry build everything around the idea of a "project". I don't want a separate environment for every project, and I don't want to start by creating a project. I want to start with an environment that has stuff in it, and I start fiddling around, and gradually something comes together that eventually will be pulled out into a separate project. From what I can see…

You can't just create yourself an "everything" environment with UV and then experiment with it? Honest question. I think you're basically suggesting that you'd have a VM or something that has system-high packages already preinstalled and then use UV on top of it?

I think that user (like me until finding out just now) didn't know that you could make ad-hoc virtual environments with uv, and that instead you would have to make a directory with a pyproject.toml and install things into it by adding to that pyproject.toml

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#877

Should I try this? I, let’s say, code with Ai and am not an engineer. Python related environment stuff makes my head explode (across the 3 computers I use). It’s the main thing my brain just can’t seem to figure out.

Well if you want to code with AI you'll have to tell claude/codex constantly that you're using uv and sometimes it'll remember.

Or, you can use a task runner like mise or just, and tell it to use the task runner instead of any particular tool directly. `mise test:unit` is much harder for an agent to get wrong.

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#878
post #693

Earlier quoted context omitted.

I wish the Python ecosystem would just switch to Rust. Things are nice over here… please port your packages to crates.

I've never used a more hostile language than rust. Some people hate python and I can't understand why but such is life. One mans meat....

For me uv seems to solve some of the worst pain points of Python, which is great since I have to work with it. I think for a lot of people the hate comes in when they have to maintain or deploy Python code in scenarios that Python and its libraries wasn't designed to do. Some stuff just makes Python seem like an "unserious" programming language to me:

1. Installation & dependencies: Don't install Python directly, instead install pyenv, use pyenv to install python and pip, use pip to install venv, then use venv to install python dependencies. For any non-trivial project you have to be incredibly careful with dependency management, because breaking changes are extremely common.

2. Useless error messages: I cannot remember outside of trivial examples without external packages when the error message I got was actually directly pointing towards the issue in the code. To give a quick example (pointing back to the point above), I got the error message "ImportError: cannot import name 'ChatResponse' from 'cohere.types'". A quick google search reveals that this happens if a) the cohere API-Key isn't set in ENV or b) you use langchain-cohere 0.4.4 with cohere 5.x, since the two aren't compatible.

3. Undisciplined I/O in libraries: Another ML library I recently deployed has a log-to-file mode. Fair enough, should be disabled before k8s deployment no biggie. Well, the library still crashes because it checks if it has rwx-permissions on a dir it doesn't need.

4. Type conversions in C-interop: Admittedly I was also on the edge of my own capabilities when I dealt with these issues, but we had issues with large integers breaking when using numpy/pandas in between to do some transforms. It was a pain to fix, because Python makes it difficult to understand what's in a variable, and what happens when it leaves Python.

1. and 4. are mainly issues with people doing stuff in Python it wasn't really designed to do. Using Python as a scripting language or a thin (!) abstraction layer over C is where it really shines. 2. and 3. have more to do with the community, but it is compounded by bad language design.

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#879
post #874

I have to say that I am extremely reluctant to switch over to yet another python management system (packaging, environment, python version). Every few years someone says: this is it. Switch to poetry! Okay, I did. And, at least for some academic packages, psychopy I'm looking at you, it was a friggin disaster. so. will uv install psychopy (say version 3.2.4)?

This is it. Switch to uv! This time for real!

It certainly isn't. See here: https://github.com/astral-sh/uv/issues/5190

And here: https://pyproject-nix.github.io/uv2nix/FAQ.html#why-doesnt-u...

Re: Uv is the best thing to happen to the Python ecosystem in a decade

#880
post #782

> curl -LsSf https://astral.sh/uv/install.sh | sh "Just pipe a random script from the internet into your shell! What could possibly go wrong?"

We've all done it. I'm curious though, I wonder what would be the best way to prevent a user from doing this.

Wrap curl to detect if /dev/stdout is a pipe and if the output is a script - this is fast because of the hash-bang. From there you can do a lot of fancy things: replace the output with echo "don't do this" ; exit 1", check the Url against a list of well known accepted scripts based on hash, run the unknown ones through an LLM to validate if they are potentially malicious, etc.
Post reply on HN