astral-sh / uv

An extremely fast Python package and project manager, written in Rust.
https://docs.astral.sh/uv
Apache License 2.0
27.24k stars 786 forks source link

Infer `.cmd` and `.ps1` extensions during `uv run` #9151

Open zanieb opened 1 week ago

zanieb commented 1 week ago

As discussed in https://github.com/astral-sh/uv/issues/8770

If the user provides uv run foo and foo.cmd or foo.ps1 exists we should invoke it unless foo.exe exists.

This is a little questionable, i.e., should we apply this to everything in the PATH? Or just the virtual environment Scripts directory?

samypr100 commented 4 days ago

Or just the virtual environment Scripts directory?

I'd expect this behavior at least from a security perspective.

Also see note in the special handling of cmd.exe and .bat

running batch scripts in this way may be removed in the future and so should not be relied upon.