Comment by dietr1ch
2 months 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
2 months 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
Yeah, 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)
Yeah, but you need curl, sudo, and bash…
"Give me a 190-byte hex0 seed of x86 assembly, and I shall compile the rest of the world." - Archimedes
1 reply →
... you must first invent the universe
As shared in a sibling comment, you can get away with just curl+shell: https://paulw.tokyo/standalone-python-script-with-uv/
The 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.
This comes with the added benefit that your environment is reverted as soon as you exit the Nix shell.
I dont think your emvironment is permanently changed with uv run?
Where does uv download the Python interpreter to?
1 reply →