Live data from Hacker News

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

emily.space

591–600 of 1001 posts

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

#591
post #445

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.

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

Is that a dare? /s

Small price to pay for escaping python dependency hell.

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

#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.

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

#593
post #520

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…

On performance: 3.13 removed the GIL and added experimental first-party JIT (like PyPy). In two years I bet we’ll be seeing v8 level performance out of CPython.

Has something changed that allows a more relaxed refcounting / less eager "gc"? Py_DECREF was what murdered any hope of performance back when we hooked up 3.3 to OMR... Well that and the complete opacity of everything implemented in C

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

#594
post #226

Earlier quoted context omitted.

Webdev since 1998 here. Tabling the python vs JS/etc to comment on npm per se. PNPM is better than npm in every way. Strongest possible recommendation to use it instead of npm; it's faster, more efficient, safer, and more deterministic. See https://pnpm.io/motivation

I've gone all-in on Bun for many of the same reasons. Blazingly fast installs too. https://bun.sh/

Bun still segfaults way too often for my comfort but I’m crossing my fingers waiting for it to mature. It is definitely nice to have an alternative runtime to Node.

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

#595

Earlier quoted context omitted.

There is nothing I dread more within the general context of software development, broadly , than trying to run other people's Python projects. Nothing. It's shocking that it has been so bad for so long.

That's because many people don't pay attention to reproducibility of their developed software. If there is no lock file in a repo that nails the exact versions and checksums, then I already know it's likely gonna be a pain. That's shoddy work of course, but that doesn't stop people from not paying attention to reproducibility. One could argue, that this is one difference between npm and such, and what many people use…

The lock file shouldn't be in the repository. That forces the developers into maintenance that's more properly the responsibility of the CI/CD pipeline. Instead, the lock file should be published with the other build artifacts—the sdist and wheel(s) in Python's case. And it should be optional so that people who know what they're doing can risk breaking things by installing newer versions of locked dependencies should the need arise.

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

#596
post #391
post #58

I hadn't paid any attention to rust before uv, but since starting to use uv, I've switched a lot of my performance-sensitive code dev to rust (with interfaces to python). These sorts of improvements really do improve my quality of life significantly. My hope is that conda goes away completely. I run an ML cluster and we have multi-gigabyte conda directories and researchers who can't reproduce anything because just to…

Have you found it easy to write rust modules with python interfaces? What tools do you recommend?

I'd be interested in this too. I know it's possible, but haven't found a good guide on how to do it well and manage the multi-lang complexity.

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

#597
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.

And a shell

No, not a shell. Just a /usr/bin/env

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

#598

Earlier quoted context omitted.

Python might have been better at this but the community was struggling with the 2 vs 3 rift for years. Maybe new tooling will change it, but my personal opinion is that python does not scale very well beyond a homework assignment. That is its sweet spot: student-sized projects.

Imo the community should've rejected Python 3 and said, find a way to improve things without breaking everyone. JS managed to do it.

The community basically did reject Python 3, at first. Almost nobody used 3.0 / 3.1 / 3.2, to the point where I’ve seen them retconned as beta releases.

Even then though, the core developers made it clear that breaking everyone’s code was the only thing they were willing to do (remember Guido’s big “No 2.8” banner at PyCon?), which left the community with no choice.

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

#599
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/

The shebang line references uv.

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

#600

Earlier quoted context omitted.

Never underestimate cultural momentum I guess. NBA players shot long 2 pointers for decades before people realized 3 > 2. Doctors refused to wash their hands before doing procedures. There’s so many things that seem obvious in retrospect but took a long time to become accepted

[flagged]

Have you considered that the repeated attempts to reinvent what's basically trains are not, in fact, evidence that people don't know about trains, but evidence that people like the advantages of trains but that the downsides suck so bad that people will pay literally tens of thousands of dollars a year to avoid them?
Post reply on HN