Live data from Hacker News

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

valatka.dev

61–70 of 428 posts

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

#61
post #20

I love this, the biggest problem I have right now with python scripts is distributing my single file utility scripts (random ops scripts). I wish there was a way to either shebang something like this or build a wheel that has the full venv inside.

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?

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

#62
post #22

Earlier quoted context omitted.

Pip doesn't resolve dependencies for you. On small projects that can be ok, but if you're working on something medium to large, or you're working on it with other people you can quickly get yourself into a sticky situation where your environment isn't easily reproducible. Using uv means your project will have well defined dependencies.

Oh wow it doesn’t? What DOES it do then? As I commented here just now I never got pip. This explains it.

[deleted]

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

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

Hot take: pnpm is the best dx, of all p/l dep toolchains, for devs who are operating regularly in many projects. Get me the deps this project needs, get them fast, then them correctly, all with minimum hoops. Cargo and deno toolchains are pretty good too. Opam, gleam, mvn/gradle, stack, npm/yarn, nix even, pip/poetry/whatever-python-malarkey, go, composer, …what other stuff have i used in the past 12 months… c/c++ do…

pnpm is the best for monorepos. I've tried yarn workspaces and npm's idea of it and nothing comes close to the DX of pnpm

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

#64
post #50

Earlier quoted context omitted.

That you can use without having 4 PhDs. It's pretty good. You should try it sometime when your done fully ingesting algebraic topology theory or whatever the fuck Nix requires to know just to install figlet.

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

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

#65

Earlier quoted context omitted.

I can't see why anyone is using Conda in 2025. In 2018, yeah, pip (now uv) was hard and you could get a "just works" experience installing Tensorflow + NVIDIA on Conda. In 2023 it was the other way around and it still is.

Well, when you're building python packages that have non python dependencies and a big chunk of your users are on Windows, conda is the only option, even in 2025 :) Examples include, quant libraries, in-house APIs/tools, etc.

Conda worked for me in the past, but at some point I was getting inexplicable segfaults from Python scripts. I switched back to just pip and everything worked fine again. And installation was much faster.

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

#66
post #28

Earlier quoted context omitted.

I’ve always worked around that by having a requirements.base.txt and a requirements.txt for the locked versions. Obviously pip doesn’t do that for you but it’s not hard to manage yourself. Having said that, I’m going to give uv a shot because I hear so many good things about it.

I’m grouchy because I finally got religion on poetry a few years ago, but the hype on uv is good enough that I’ll have to give it a shot.

I freaking love Poetry. It was a huge breath of fresh air after years of pip and a short detour with Pipenv. If uv stopped existing I’d go back to Poetry.

But having tasted the sweet nectar of uv goodness, I’m onboard the bandwagon.

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

#67
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?

Much of the Python ecosystem blatantly violates semantic versioning. Most new tooling is designed to work around the bugs introduced by this.

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

#68

I love this, the biggest problem I have right now with python scripts is distributing my single file utility scripts (random ops scripts). I wish there was a way to either shebang something like this or build a wheel that has the full venv inside.

You mean like pyinstaller https://pyinstaller.org that takes your python and makes a standalone, self extracting or onedir archive to convert you ops script plus dependencies into something you can just distribute like a binary?

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

#70

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?

Well, for one you can't actually package or add a local requirement (for example , a vendored package) to the usual pip requirements.txt (or with pyproject.toml, or any other standard way) afaik. I saw a discourse reply that cited some sort of possible security issue but that was basically it and that means that the only way to get that functionality is to not use pip. It's really not a lot of major stuff, just a lot…

Sure you can.

It's in their example for how to use requirements.txt: https://pip.pypa.io/en/stable/reference/requirements-file-fo...

Maybe there's some concrete example you have in mind though?

Post reply on HN