E.g.:
#!/usr/bin/env python3 # /// script # requires-python = ">=3.11" # dependencies = [ # "psycopg2-binary", # "pyyaml", # ] # ///
uv run -s file.py
import os print(os.environ['VIRTUAL_ENV'] + '/bin/python')
uv python find --script foo.py
— https://docs.astral.sh/uv/reference/cli/#uv-python-find--scr...
#!/usr/bin/env uv run --script
> Using uv as your shebang line
— https://news.ycombinator.com/item?id=42855258
Since `env` doesn’t pass multiple arguments by default, the suggested line uses `-S`:
#!/usr/bin/env -S uv run --script
#!/home/tetha/Tools/uv run
#!/usr/bin/env uv run
E.g.:
Then -