TIL: if you’re using uv everything packs itself

you can feed your script to uv with the following she-bang invocation (the --script flag will process the balance of the script as the script. standalone scripts can run in a virtualenv within uv and internally resolve their dependencies. we needed this years ago.

#!/usr/bin/env -S uv run --script

# /// script
# requires-python = ">=3.12"
# dependencies = [ "requests" ]
# ///

uv allows you to package up your dependencies at the top of a script using TOML formatted structures in the comments.

details: Running scripts | uv