-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect if a script is called with uv run
#8775
Comments
Seems fine to me, though I'm a little wary of people keying behavior off of executing in a uv context in general. |
This could also be helpful for the infinitely-recursive shebang @zanieb... |
True I basically suggested this as a solution. Though the problem there is we can't tell if the recursion is intentional or not without capturing more information. |
Your could increment the count in the env car, so |
Fwiw, (maybe supports @zanieb's point) I no longer need this right now. Although I think adding the env var is still a good idea. |
This sounds like something that would fit nicely into the |
Closed in #11326 |
I'd like to know if my script was called with
uv run
, but there doesn't seem to be an obvious way to tell.I suggest you set an extra environment variable (e.g.
UV=1
) which the process can use to check if it was called that way.(My use case if it matters is that I'm printing instructions on how to run other scripts, and I'd like to show "Run with
uv run -m ...
" or "Run withpython -m ...
")The text was updated successfully, but these errors were encountered: