Live data from Hacker News

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

emily.space

821–830 of 1001 posts

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

#821
post #95

Earlier quoted context omitted.

> how much I prefer prepending "uv" to everything instead of activating environments You can also prepend the path to the virtual environment's bin/ (or Scripts/ on Windows). Literally all that "activating an environment" does is to manipulate a few environment variables. Generally, it puts the aforementioned directory on the path, sets $VIRTUAL_ENV to the venv root, configures the prompt (on my system that means mod…

I would very much like to know the reason why they named it bin/ here and Scripts/ there. To get some closure.

Annoys me to no end as well. I don't have an answer for you, but I would like one too.

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

#822
post #167

Earlier quoted context omitted.

Isn't uv like... a Rust binary? If that sh has any sense it just copies the binary and adds it to PATH.

but since you are curling a web URL straight to sh you will never know. which is the problem.

What about running a downloaded binary installer? What if the URL is HTTPS?

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

#823

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…

I think Python has a place in many developers toolkits. I've never met anyone who hates Python (though I'm sure they exist), whereas for pretty much any other language one could mention there are much more polarizing viewpoints. (as the saying goes "Python is everyone's second favorite programming language"). The Python team needs not feel any pressure to change to compete, Python has already done quite well and foun…

I hate python and I use it everyday because I work in the data space. Its a toy scripting / glue language that has gotten used for far too much that it was not designed for. The usual suspects are also really annoying, such as white space instead of {}, no types, its so damn slow and all projects use so many packages and the packages use packages etc. That last one could just be a personal preference thing to I will admit, but the rest are just almost objectively bad. Especially when building infrastructure like a data platform.

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

#824

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.

You don't have to remember this, instead remember `uv init --script myscript.py`

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

#825

uv is spectacular But I’m utterly shocked that UV doesn’t support “system dependencies”. It’s not a whole conda replacement. Which is a shame because I bloody hate Conda. Dependencies like Cuda and random C++ libraries really really ought to be handled by UV. I want a true genuine one stop shop for running Python programs. UV is like 80% of the way there. But the last 20% is still painful. Ideally UV would obsolete t…

Does uv use a sandbox or do process isolation?

I've switched to running any and all python projects in Docker as a way to ensure that low effort supply chain attacks doesn't easily get everything in my home dir. So even if I use uv, I'd only do that in a Docker image for now

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

#826

Earlier quoted context omitted.

I think Python has a place in many developers toolkits. I've never met anyone who hates Python (though I'm sure they exist), whereas for pretty much any other language one could mention there are much more polarizing viewpoints. (as the saying goes "Python is everyone's second favorite programming language"). The Python team needs not feel any pressure to change to compete, Python has already done quite well and foun…

raises hand I hate python. Every python codebase i’ve had to look after has rotten to the point it doesn’t even build and is a maintenance nightmare. I also hate whitespace instead of {}

i resist saying that i hate python because that implies that i don't hate aspects of basically all alternatives (or all that are popular anyway)

like with everything else these days, it's about living with it and try to make the best of the good parts of it

i remember getting told in the 00s that i would get used to and love the whitespace-based block definition, and boy i hate it now more than ever with 1000s of hours spent looking at and coding in python

but it is what it is, for whatever reason it has become a must in many particular industries a lot like Java took over some earlier on although it seems to be fading, and javascript is a must in others

it really isn't just about programming languages that these days you either learn to live with some massive annoyances and practices you may hate, or withdraw entirely from society

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

#827

Earlier quoted context omitted.

> But then I remember that Python is dog slow compared to other languages with comparable ergonomics and first-class support for static typing, and...idk it's a tough sell. Post like these aptly describe why companies are downsizing in lieu of AI assistants, and they are not wrong for doing so. Yes, Python is "slow". The thing is, compute is cheap these days and development time is expensive. $1000 per month is consi…

The irony here is UV is written in Rust.

That's not exactly for slowness reasons. The creators of uv have stated that if pip followed the same algorithms they'd see similar performance benefits. People greatly overstate the Python performance penalty.

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

#828

Earlier quoted context omitted.

This was always my issue with pip and venv: I don’t want a thing that hijacks my terminal and PATH, flips my world upside down and makes writing automated headless scripts and systemd services a huge pain. When I drop into a Node.js project, usually some things have changed, but I always know that if I need to, I can find all of my dependencies in my node_modules folder, and I can package up that folder and move it w…

> Python/pip though… Every time I need to containerize or setup a Python project for some arbitrary task, there’s always an issue with “Your Linux distro doesn’t support that version of Python anymore” [...] How are you containerizing Python projects? What confuses me about your statement are the following things: (1) How old must the Python version of those projects be, to not be supported any longer with any decent…

> (2) Are you not using official Python docker images?

Would you help me make it work?

  docker run -it --rm -v$(pwd):/venv --entrypoint python python:3.12-alpine -m venv /venv/remt-docker-venv
How do I source it?

  cd remt-docker-venv/
  source bin/activate
  python --version
  bash: python: command not found

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

#829

Earlier quoted context omitted.

I wish we had a language that had the syntax of Python (notably including operator overloading, which is absolutely critical for neural networks, ML, data science and numerical computations), the performance, compile times and concurrency support of Go, the type system flexibility of Typescript, and the native platform integration of C/C++.

Than you would probably like the Nim[1] programming language. It has the syntax of python, but transpiles to C/C++. A good type system. The main problem would probably the compiles times. Because you basically compile just C/C++ code. And of course the eco-system is much much smaller than Python. [1] https://nim-lang.org/

I agree with this sentiment.

I try to learn the basics of new programming language regularly and write a small lisp alike interpreter in it and give myself a maximum of 2 days working on it. It covers things like string handling, regexp, recursion, lambdas, garbage collection, ... and run them through a tiny test suite.

In Python and JS, it was easy to do it and the code was still very readable. In C++, the language I earn my money from, I had a bug I was not able to fix within the given time frame, happening just with gcc not clang, assuming some undefined behavior. In C, I was able to add my own garbage collector with muss less work than I expected ... but

Nim really impressed me, it really felt almost like I wrote it in Python, but an executable which run on its own and being quite a bit faster.

Working mostly in the embedded world, where ecosystem matters somewhat less. If any employee ever would give me a chance to choose a language myself I would definitely try to write a first prototype in Nim.

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

#830
post #824

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.

You don't have to remember this, instead remember `uv init --script myscript.py`

Thats the same thing?
Post reply on HN