Skip to content

Route Python upgrade request errors through UvError - #21568

Merged
zanieb merged 1 commit into
zb/tool-upgrade-error-hintsfrom
zb/python-upgrade-error-hints
Sep 11, 2026
Merged

zanieb merged 1 commit into
zb/tool-upgrade-error-hintsfrom
zb/python-upgrade-error-hints

Conversation

@zanieb

@zanieb zanieb commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Python upgrade rejects patch and prerelease requests by printing directly to ordinary stderr, so -q hides the error and its .python-version guidance. Represent this as a typed user error and collect the version-file hint through Hinted. The message remains visible with -q, is suppressed with -qq, and keeps exit code 1. Explicit command-line version requests do not receive the version-file hint.

Prior work:

@zanieb
zanieb added this pull request to stack #21567 September 9, 2026 19:12
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from 1f48ab2 to d14cb29 Compare September 9, 2026 19:20
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from d14cb29 to c4c613b Compare September 9, 2026 19:35
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from c4c613b to c634794 Compare September 10, 2026 04:04
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from c634794 to 6dc25f6 Compare September 10, 2026 04:09
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from 6dc25f6 to ef229c5 Compare September 10, 2026 04:42
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from ef229c5 to fc94d09 Compare September 10, 2026 04:47
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from fc94d09 to db72fd6 Compare September 10, 2026 13:05
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from db72fd6 to 9f217a0 Compare September 10, 2026 13:22
@zanieb
zanieb removed this pull request from stack #21567 September 10, 2026 13:23
@zanieb
zanieb added this pull request to stack #21578 September 10, 2026 13:23
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from 9f217a0 to a2ecf06 Compare September 10, 2026 13:36
@zanieb
zanieb removed this pull request from stack #21578 September 10, 2026 15:05
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from a2ecf06 to a097227 Compare September 10, 2026 15:07
@zanieb
zanieb added this pull request to stack #21585 September 10, 2026 15:07
@zanieb
zanieb removed this pull request from stack #21585 September 10, 2026 15:42
@zanieb
zanieb added this pull request to stack #21588 September 10, 2026 15:43
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from a097227 to 1624ea5 Compare September 10, 2026 20:11
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from 1624ea5 to db48d61 Compare September 10, 2026 21:51
@zanieb
zanieb marked this pull request as ready for review September 10, 2026 21:53
@zanieb zanieb added the internal A refactor or improvement that is not user-facing label Sep 10, 2026
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from db48d61 to 83e64dd Compare September 10, 2026 22:18
@zanieb
zanieb force-pushed the zb/python-upgrade-error-hints branch from 83e64dd to 132eefa Compare September 11, 2026 18:12
@zanieb zanieb changed the title Route Python upgrade request errors through UvError Route Python upgrade request errors through UvError Sep 11, 2026
@zanieb
zanieb merged commit c174872 into main Sep 11, 2026
80 of 86 checks passed
@zanieb
zanieb deleted the zb/python-upgrade-error-hints branch September 11, 2026 18:37
zanieb added a commit that referenced this pull request Sep 11, 2026
Route the remaining package-operation errors through `UvError` and the
standard error-chain renderer, then remove uv's direct `miette`
dependency and global hook. Diagnostics use the same source-chain
formatting and hint collection as other commands, with cause-specific
hints before general command advice. No-solution headings omit trailing
punctuation, retain their command context, and are not repeated inside
build-dependency errors. Final errors remain visible with `-q` and are
suppressed with `-qq`.

Classify operation failures by their underlying cause instead of by
which renderer handles them. Each error type owns its classification,
and type-erased build errors forward it. Expected package, resolution,
build, integrity, and lock-validation failures use code 1, while
recognized transport, cache, filesystem, and internal failures use code
2. This deliberately changes some previously inconsistent statuses
without attempting to normalize every standalone command or opaque
archive-error path. Command-line argument errors remain code 2.
Third-party dependencies may still use `miette` internally.

Prior work:

- #14546 removed `miette` from `uv venv`.
- #17535 added first-party line wrapping.
- #18090 established the `Hint` and `Hints` APIs.
- #20155 made hints explicit in error-chain rendering.
- #20156 preserved indentation in multiline causes.
- #20159 migrated `uv build` errors to standard rendering.
- #20160 migrated tool requirement errors to standard rendering.
- #20188 introduced the explicit `UvError` model.
- #20163 routed final errors through `Printer` for `-q` and `-qq`.
- #20217 enabled cause-chain rendering for user errors.
- #21563 added verification of index-provided metadata hashes.
- #21279 reused URL-provided hashes during resolution.
- #21584 renamed the hint-producing trait to `Hinted`.
- #21577 added explicit hint ordering.

Follow-up work:

- #21566 collects hints for batched `uv tool upgrade` failures and fixes
their quiet-mode output.
- #21568 routes Python upgrade request errors and version-file hints
through `UvError`.
- #21587 separates operation-specific diagnostic context from
exit-status classification.
- #21599 renders error and warning causes with compact tree connectors.

This branch was previously deployed

1 inactive deployment
automations — 132eefa9 Deployed Sep 11, 2026 by zanieb via review / security review #46445
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal A refactor or improvement that is not user-facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant