Add support for Windows legacy scripts via uv tool run (#12079)

## Summary

Follow up to https://github.com/astral-sh/uv/pull/11888 with added
support for uv tool run.

Changes
* Added functionality for running windows scripts in previous PR was
moved from run.rs to uv_shell::runnable.
* EXE was added as a supported type, this simplified integration across
both uv run and uvx while retaining a backwards compatible behavior and
properly prioritizing .exe over others. Name was adjusted to runnable as
a result to better represent intent.

## Test Plan

New tests added.

## Documentation

Added new documentation.
This commit is contained in:
samypr100 2025-03-11 10:02:17 -04:00 committed by GitHub
parent 82212bb439
commit e096ab2411
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 474 additions and 87 deletions

View file

@ -264,6 +264,27 @@ $ uv tool upgrade --python 3.10 ruff
For more details on requesting Python versions, see the
[Python version](../concepts/python-versions.md#requesting-a-version) concept page..
## Legacy Windows Scripts
Tools also support running
[legacy setuptools scripts](https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#scripts).
These scripts are available via `$(uv tool dir)\<tool-name>\Scripts` when installed.
Currently only legacy scripts with the `.ps1`, `.cmd`, and `.bat` extensions are supported.
For example, below is an example running a Command Prompt script.
```console
$ uv tool run --from nuitka==2.6.7 nuitka.cmd --version
```
In addition, you don't need to specify the extension. `uvx` will automatically look for files ending
in `.ps1`, `.cmd`, and `.bat` in that order of execution on your behalf.
```console
$ uv tool run --from nuitka==2.6.7 nuitka --version
```
## Next steps
To learn more about managing tools with uv, see the [Tools concept](../concepts/tools.md) page and