Earlier quoted context omitted.
Yes, uv is well suited to that use case by declaring your Python version and/or dependencies right in the script itself: https://docs.astral.sh/uv/guides/scripts/#declaring-script-d... You can use an alternate shebang line so you can run the script directly: #!/usr/bin/env -S uv run --script # /// script # requires-python = ">=3.12" # dependencies = [ # "requests", # "typer-slim", # ] # /// import requests import typ…
Yes but I then still then have to declare all dependencies for all tiny throwaway script, right now I have global python in pyenv and installed tons of plugins and didn't have too much issues with conflicts so was good enough for me
Uv takes the position that since it’s so fast to install dependencies and create environments, you don’t maintain a global venv.
uvx ruff file.py
Will setup a venv, install ruff into it, and run over your file. https://docs.astral.sh/uv/guides/tools/Otherwise you can:
uv run —-with package file.py
If you don’t want to declare your dependencies.https://docs.astral.sh/uv/guides/scripts/#running-a-script-w...