3 ms·
Yeah, but you need `uv`. If we are reaching out for tools that might not be around, then you can also depend on nix-shell, #! /usr/bin/env nix-shell #!
by dietr1ch 10mo ago
Yeah, but you need `uv`. If we are reaching out for tools that might not be around, then you can also depend on nix-shell,
#! /usr/bin/env nix-shell
#! nix-shell -i python3 --packages python3
- mystifyingpoi 10mo agoYeah, but you need Nix. If we are reaching out for tools that might not be around, then you can also depend on `curl | sudo bash` to install Nix when not present. (this is a joke btw)
- jonhohle 10mo agoYeah, but you need curl, sudo, and bash…
- lioeters 10mo ago"Give me a 190-byte hex0 seed of x86 assembly, and I shall compile the rest of the world." - Archimedes
- Imustaskforhelp 10mo agoamazing quote. Adding it to my about page, do you want credit or shall I credit it to archimedes xD On a serious note, its so brilliant that something like this is now possible when we think about it. It's maddeningly crazy to think about all the process but in the end that you can end up with a system / linux iso whose hash you can trust/independently verify and then you use it and spread around the world. Definitely makes me feel as sky's the only limit or just its very pleasant to think about it.
- JodieBenitez 10mo ago... you must first invent the universe
- Cyph0n 10mo agoThis comes with the added benefit that your environment is reverted as soon as you exit the Nix shell.
- fastasucan 10mo agoI dont think your emvironment is permanently changed with uv run?
- Cyph0n 10mo agoWhere does uv download the Python interpreter to?
- exographicskip 10mo agoBy default, it's `~/Library/Caches/uv/environments-v2/` on macos. Can find via `uv cache dir` See: https://docs.astral.sh/uv/reference/cli/#uv-cache-dir https://docs.astral.sh/uv/reference/cli/#uv-cache-dir
- kokada 10mo agoThe issue I have with `nix-shell` is that the evaluation time is long, so if you need to run the script repeatedly it may take a long time. `nix shell` at least fix this issue by caching evaluations, but I think uv is still faster.
- m3at 10mo agoAs shared in a sibling comment, you can get away with just curl+shell: https://paulw.tokyo/standalone-python-script-with-uv/ https://paulw.tokyo/standalone-python-script-with-uv/