Skip to content

Conversation

@samypr100
Copy link
Collaborator

@samypr100 samypr100 commented Mar 2, 2025

Summary

Closes #9151

This adds support for running .ps1, .cmd, .bat legacy scripts typically provided by setuptools legacy script files.

Note, .bat and .cmd scripts were somewhat supported previously by Command when the extension was explicit but documentation says such behavior should not be relied upon.

In addition, when no extension is provided and a legacy script exists, it will try to infer the appropriate extension on Windows and use the right runtime with preference for .ps1. Only powershell.exe and cmd.exe are supported right now.

Test Plan

Added tests. Tested with nuitka locally via uv run.

Note uvx support will be added in a follow up.

@samypr100 samypr100 added the windows Specific to the Windows platform label Mar 2, 2025
@samypr100 samypr100 force-pushed the windows-legacy-scripts branch from 2d691cb to eba35f7 Compare March 2, 2025 00:47
@samypr100 samypr100 marked this pull request as ready for review March 2, 2025 00:48
@charliermarsh charliermarsh requested a review from zanieb March 2, 2025 00:48
@charliermarsh
Copy link
Member

Nice, thanks.

@samypr100 samypr100 force-pushed the windows-legacy-scripts branch 2 times, most recently from b1d3c8b to aa5a434 Compare March 2, 2025 03:00
@zanieb zanieb self-assigned this Mar 2, 2025
@samypr100 samypr100 force-pushed the windows-legacy-scripts branch from 1b942c9 to 5fae98a Compare March 2, 2025 20:28
Copy link
Member

@zanieb zanieb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@zanieb
Copy link
Member

zanieb commented Mar 5, 2025

We should probably add some docs to this in the uv run reference and / or concept pages? I think that can happen after though.

@zanieb zanieb merged commit 0fb5291 into astral-sh:main Mar 5, 2025
74 checks passed
@samypr100 samypr100 deleted the windows-legacy-scripts branch March 6, 2025 00:01
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Mar 10, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.6.4` -> `0.6.5` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>astral-sh/uv (astral-sh/uv)</summary>

### [`v0.6.5`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#065)

[Compare Source](astral-sh/uv@0.6.4...0.6.5)

##### Enhancements

-   Allow `--constraints` and `--overrides` in `uvx` ([#&#8203;10207](astral-sh/uv#10207))
-   Allow overrides in `satisfies` check for `uv tool run` ([#&#8203;11994](astral-sh/uv#11994))
-   Allow users to set `package = true` on `tool.uv.sources` ([#&#8203;12014](astral-sh/uv#12014))
-   Add support for Windows legacy scripts via `uv run` ([#&#8203;11888](astral-sh/uv#11888))
-   Return error when running uvx with a `.py` script ([#&#8203;11623](astral-sh/uv#11623))
-   Warn user on use of `uvx run` ([#&#8203;11992](astral-sh/uv#11992))

##### Configuration

-   Add `NO_BUILD` and `NO_BUILD_PACKAGE` environment variables ([#&#8203;11968](astral-sh/uv#11968))

##### Performance

-   Allow overrides in all satisfies checks ([#&#8203;11995](astral-sh/uv#11995))
-   Respect markers on constraints when validating current environment ([#&#8203;11976](astral-sh/uv#11976))

##### Bug fixes

-   Compare major-minor specifiers when filtering interpreters ([#&#8203;11952](astral-sh/uv#11952))
-   Fix system site packages detection default ([#&#8203;11956](astral-sh/uv#11956))
-   Invalidate lockfile when empty dependency groups are added or removed ([#&#8203;12010](astral-sh/uv#12010))
-   Remove prepended sys.path ([#&#8203;11954](astral-sh/uv#11954))
-   Fix PyPy Python version label ([#&#8203;11965](astral-sh/uv#11965))
-   Fix error message suggesting `--user` instead of `--username` ([#&#8203;11947](astral-sh/uv#11947))

##### Preview

-   Move the uv build backend into a separate, minimal `uv_build` package ([#&#8203;11446](astral-sh/uv#11446))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xODguMyIsInVwZGF0ZWRJblZlciI6IjM5LjE4OC4zIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
@kdeldycke
Copy link

I confirm the issue has been fixed in uv 0.6.5, see: Nuitka/Nuitka#3173 (comment)

zanieb pushed a commit that referenced this pull request Mar 11, 2025
## Summary

Follow up to #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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

windows Specific to the Windows platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Infer .cmd and .ps1 extensions during uv run

4 participants