Live data from Hacker News

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

emily.space

631–640 of 1001 posts

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

#631
post #445

Earlier quoted context omitted.

> The script now works like a standalone executable But whoever runs this has to install uv first, so not really standalone.

This is a PEP and not specific to uv: https://peps.python.org/pep-0723/

You need a runner for scripts that follow the PEP (actually the packaging standard established initially by the PEP, hence the note about it's historical status.)

The two main runners I am aware of are uv and pipx. (Any compliant runner can be referenced in the shebang to make a script standalone where shebangs are supported.)

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

#634
post #42

Earlier quoted context omitted.

If I were to put on my security hat, things like this give me shivers. It's one thing if you control the script and specified the dependencies. For any other use-case, you're trusting the script author to not install python dependencies that could be hiding all manner of defects or malicious intent. This isn't a knock against UV, but more a criticism of dynamic dependency resolution. I'd feel much better about this i…

""" uv is straightforward to install. There are a few ways, but the easiest (in my opinion) is this one-liner command — for Linux and Mac, it’s: curl -LsSf https://astral.sh/uv/install.sh | sh """ Also isn't great. But that's how homebrew is installed, so ... shrug ... ? Not to bash uv/homebrew, they are better than most _easy_ alternatives.

There's a completely irrational knee-jerk reaction to curl|sh. Do you trust the source or not? People who gripe about this will think nothing of downloading a tarball and running "make install", or downloading an executable and installing it in /usr/local/bin.

I will happily copy-paste this from any source I trust, for the same reason I'll happily install their software any other way.

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

#635

For single-file Python scripts, which 99% of mine seem to be, you can simplify your life immensely by just putting this at the top of the script: #!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.11" # dependencies = [ "modules", "here" ] # /// The script now works like a standalone executable, and uv will magically install and use the specified modules.

Yeah, tried it with some rest client + pyfzf (CLI swagger UI sort of), it was really fun. Near instant dependency handling.. pretty cool

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

#636

I'd put type annotations and GIL removal above UV without a second thought. UV is still young and I hit some of those growing pains. While it is very nice, I'm not going to put it up there with sliced bread, it's just another package manager among many

I don't want type annotations. Was kinda the point of Python not to deal with types.

If you've ever used python on a project above a certain size (both lines of code and people who contribute to it), type annotations quickly become something you find useful.

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

#638

Uv is so good. I'm a curmudgeon about adopting new tooling, and tried uv with a lot of skepticism, but it was just better in every way. And even if it wasn't so polished and reliable, the raw speed makes it hard to go back to any other tool. Uv combined with type hints reaching critical mass in the Python ecosystem, and how solid PyLance is in VSCode, feels so good it has made me consider investing in Python as my pr…

Am I the only one that's sad that poetry happened before pdm otherwise we might have had pdm as a standard instead of uv, addressing many of the things uv addresses without all the extra bells and whistles that make it cumbersome. I don't like the wedding between package manager and install manager. ... but then again neither pdm nor uv would have happened without poetry.

How do extra bells and whistles bother you? You had the option to not use them. Like you said yourself, they’re “extra”.

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

#639
post #592
post #145

I still feel bitten by diving into poetry when starting some projects. Has the ecosystem fully moved on to uv, now? Do they have good influence on what python's main ecosystem is moving to?

I for now prefer to stick to whatever the default is from the python packaging crew and standard library i.e. `python -m venv` and `pip install` inside of it. Python for me is great when things can remain as simple to wrap your head around as possible.

Managing environments with `python -m venv` and all of the easy ways that goes wrong is exactly what I don't want to deal with. Is almost enough to make me never want to use python.
Post reply on HN