←back to thread

Fun with uv and PEP 723

(www.cottongeeks.com)
618 points deepakjois | 1 comments | | HN request time: 0.223s | source
Show context
ACAVJW4H ◴[] No.44370555[source]
finally feels like Python scripts can Just Work™ without a virtualenv scavenger hunt.

Now if only someone could do the same for shell scripts. Packaging, dependency management, and reproducibility in shell land are still stuck in the Stone Ages. Right now it’s still curl | bash and hope for the best, or a README with 12 manual steps and three missing dependencies.

Sure, there’s Nix... if you’ve already transcended time, space, and the Nix manual. Docker? Great, if downloading a Linux distro to run sed sounds reasonable.

There’s got to be a middle ground simple, declarative, and built for humans.

replies(16): >>44370574 #>>44370603 #>>44370609 #>>44370667 #>>44370757 #>>44370943 #>>44371081 #>>44371402 #>>44372258 #>>44372278 #>>44372472 #>>44372942 #>>44373775 #>>44374090 #>>44374399 #>>44376192 #
bigstrat2003 ◴[] No.44370667[source]
> Packaging, dependency management, and reproducibility in shell land are still stuck in the Stone Ages.

IMO it should stay that way, because any script that needs those things is way past the point where shell is a reasonable choice. Shell scripts should be small, 20 lines or so. The language just plain sucks too much to make it worth using for anything bigger.

replies(4): >>44372677 #>>44374216 #>>44374396 #>>44375053 #
xavdid ◴[] No.44374216[source]
My rule of thumb is that as soon as I write a conditional, it's time to upgrade bash to Python/Node/etc. I shouldn't have to search for the nuances of `if` statements every time I need to write them.
replies(3): >>44379432 #>>44380173 #>>44384656 #
1. colonial ◴[] No.44384656[source]
This is a decent heuristic, although (IMO) you can usually get away with ~100 lines of shell without too much headache.

Last year I wrote (really, grew like a tumor) a 2000 line Fish script to do some Podman magic. The first few hundred lines were great, since it was "just" piping data around - shell is great at that!

It then proceeded to go completely off the rails when I went full sunk cost fallacy and started abusing /dev/shm to emulate hash tables.

E: just looked at the source code. My "build system" was another Fish script that concatenated several script files together. Jeez. Never again.