-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Add hint for misplaced --verbose in uv tool run
#17020
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
Conversation
|
@F4RAN thanks for this. Aside from the review comment, do you mind adding a test? There are a few examples in crates/uv/tests/it/tool_run.rs. |
crates/uv/src/commands/tool/run.rs
Outdated
|
|
||
| fn find_verbose_flag(args: &[std::ffi::OsString]) -> Option<&str> { | ||
| for arg in args { | ||
| if let Some(arg_str) = arg.to_str() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I might use let Some(...) = ... else { continue } just to reduce nesting
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Used ? operator instead of let...else (clippy also suggested this)
crates/uv/src/commands/tool/run.rs
Outdated
| } | ||
|
|
||
| fn find_verbose_flag(args: &[std::ffi::OsString]) -> Option<&str> { | ||
| for arg in args { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I might write this using args.iter().find(...) instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored to use find_map as suggested
Added hint for when users put --verbose in the wrong place. Refactored based on review feedback and added tests.
Hi @EliteTK and @zanieb. Thanks for reviewing my code.
All feedback addressed! Happy to make any additional changes if needed. |
--verbose
|
@F4RAN thanks for sorting those out. I've pushed a couple of commits to drop the filter as it's not something we normally do in the test suite and add a test case for the potential false positive case. I've made a note to create an issue regarding the |
--verbose--verbose in uv tool run
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [astral-sh/uv](https://github.com/astral-sh/uv) | patch | `0.9.13` -> `0.9.17` | 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.9.17`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0917) [Compare Source](astral-sh/uv@0.9.16...0.9.17) Released on 2025-12-09. ##### Enhancements - Add `torch-tensorrt` and `torchao` to the PyTorch list ([#​17053](astral-sh/uv#17053)) - Add hint for misplaced `--verbose` in `uv tool run` ([#​17020](astral-sh/uv#17020)) - Add support for relative durations in `exclude-newer` (a.k.a., dependency cooldowns) ([#​16814](astral-sh/uv#16814)) - Add support for relocatable nushell activation script ([#​17036](astral-sh/uv#17036)) ##### Bug fixes - Respect dropped (but explicit) indexes in dependency groups ([#​17012](astral-sh/uv#17012)) ##### Documentation - Improve `source-exclude` reference docs ([#​16832](astral-sh/uv#16832)) - Recommend `UV_NO_DEV` in Docker installs ([#​17030](astral-sh/uv#17030)) - Update `UV_VERSION` in docs for GitLab CI/CD ([#​17040](astral-sh/uv#17040)) ### [`v0.9.16`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0916) [Compare Source](astral-sh/uv@0.9.15...0.9.16) Released on 2025-12-06. ##### Python - Add CPython 3.14.2 - Add CPython 3.13.11 ##### Enhancements - Add a 5m default timeout to acquiring file locks to fail faster on deadlock ([#​16342](astral-sh/uv#16342)) - Add a stub `debug` subcommand to `uv pip` announcing its intentional absence ([#​16966](astral-sh/uv#16966)) - Add bounds in `uv add --script` ([#​16954](astral-sh/uv#16954)) - Add brew specific message for `uv self update` ([#​16838](astral-sh/uv#16838)) - Error when built wheel is for the wrong platform ([#​16074](astral-sh/uv#16074)) - Filter wheels from PEP 751 files based on `--no-binary` et al in `uv pip compile` ([#​16956](astral-sh/uv#16956)) - Support `--target` and `--prefix` in `uv pip list`, `uv pip freeze`, and `uv pip show` ([#​16955](astral-sh/uv#16955)) - Tweak language for build backend validation errors ([#​16720](astral-sh/uv#16720)) - Use explicit credentials cache instead of global static ([#​16768](astral-sh/uv#16768)) - Enable SIMD in HTML parsing ([#​17010](astral-sh/uv#17010)) ##### Preview features - Fix missing preview warning in `uv workspace metadata` ([#​16988](astral-sh/uv#16988)) - Add a `uv auth helper --protocol bazel` command ([#​16886](astral-sh/uv#16886)) ##### Bug fixes - Fix Pyston wheel compatibility tags ([#​16972](astral-sh/uv#16972)) - Allow redundant entries in `tool.uv.build-backend.module-name` but emit warnings ([#​16928](astral-sh/uv#16928)) - Fix infinite loop in non-attribute re-treats during HTML parsing ([#​17010](astral-sh/uv#17010)) ##### Documentation - Clarify `--project` flag help text to indicate project discovery ([#​16965](astral-sh/uv#16965)) - Regenerate the crates.io READMEs on release ([#​16992](astral-sh/uv#16992)) - Update Docker integration guide to prefer `COPY` over `ADD` for simple cases ([#​16883](astral-sh/uv#16883)) - Update PyTorch documentation to include information about supporting CUDA 13.0.x ([#​16957](astral-sh/uv#16957)) - Update the versioning policy ([#​16710](astral-sh/uv#16710)) - Upgrade PyTorch documentation to latest versions ([#​16970](astral-sh/uv#16970)) ### [`v0.9.15`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0915) [Compare Source](astral-sh/uv@0.9.14...0.9.15) Released on 2025-12-02. ##### Python - Add CPython 3.14.1 - Add CPython 3.13.10 ##### Enhancements - Add ROCm 6.4 to `--torch-backend=auto` ([#​16919](astral-sh/uv#16919)) - Add a Windows manifest to uv binaries ([#​16894](astral-sh/uv#16894)) - Add LFS toggle to Git sources ([#​16143](astral-sh/uv#16143)) - Cache source reads during resolution ([#​16888](astral-sh/uv#16888)) - Allow reading requirements from scripts without an extension ([#​16923](astral-sh/uv#16923)) - Allow reading requirements from scripts with HTTP(S) paths ([#​16891](astral-sh/uv#16891)) ##### Configuration - Add `UV_HIDE_BUILD_OUTPUT` to omit build logs ([#​16885](astral-sh/uv#16885)) ##### Bug fixes - Fix `uv-trampoline-builder` builds from crates.io by moving bundled executables ([#​16922](astral-sh/uv#16922)) - Respect `NO_COLOR` and always show the command as a header when paging `uv help` output ([#​16908](astral-sh/uv#16908)) - Use `0o666` permissions for flock files instead of `0o777` ([#​16845](astral-sh/uv#16845)) - Revert "Bump `astral-tl` to v0.7.10 ([#​16887](astral-sh/uv#16887))" to narrow down a regression causing hangs in metadata retrieval ([#​16938](astral-sh/uv#16938)) ##### Documentation - Link to the uv version in crates.io member READMEs ([#​16939](astral-sh/uv#16939)) ### [`v0.9.14`](https://github.com/astral-sh/uv/blob/HEAD/CHANGELOG.md#0914) [Compare Source](astral-sh/uv@0.9.13...0.9.14) Released on 2025-12-01. ##### Performance - Bump `astral-tl` to v0.7.10 to enable SIMD for HTML parsing ([#​16887](astral-sh/uv#16887)) ##### Bug fixes - Allow earlier post releases with exclusive ordering ([#​16881](astral-sh/uv#16881)) - Prefer updating existing `.zshenv` over creating a new one in `tool update-shell` ([#​16866](astral-sh/uv#16866)) - Respect `-e` flags in `uv add` ([#​16882](astral-sh/uv#16882)) ##### Enhancements - Attach subcommand to User-Agent string ([#​16837](astral-sh/uv#16837)) - Prefer `UV_WORKING_DIR` over `UV_WORKING_DIRECTORY` for consistency ([#​16884](astral-sh/uv#16884)) </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:eyJjcmVhdGVkSW5WZXIiOiI0Mi4yNy4xIiwidXBkYXRlZEluVmVyIjoiNDIuNDAuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90Il19-->
Resolves #16777
Summary
When a command fails, users sometimes add --verbose after the package name (e.g., uvx foo --verbose) instead of before it (e.g., uvx --verbose foo). This adds a hint that suggests moving --verbose before the command.
The hint appears when a verbose flag is detected in the subcommand arguments and the command fails to resolve. It works for both uvx and uv tool run.
Test Plan
Tested by running:
uvx foo-does-not-exist --verbose - shows the hint
uv tool run foo-does-not-exist --verbose - shows the hint
The hint only appears when verbose flags are detected, and the message shows the correct command format.
Screenshot
Open to feedback and happy to make changes as needed! 💯