← Back to Pull requests

Switch to auto-updating spinners wholesale #14238

Open
unknown opened this pull request with 431 lines diff across 5 files
View on GitHub
unknown unknown commented on Aug 08, 2026 23:26 UTC
Author

These are easier to work with and are more flexible since they don't have a spin() method that needs to be called constantly. One such auto-updating spinner, _PipRichSpinner, was already added for the inprocess build dependency installer. This commit extends this concept for the rest of the codebase.

Please note the new spinner interface is a bit weird. For one, spinners can be marked as finished multiple times with only the first call taking effect. This is necessary to ensure robust error handling in case the spinner's caller doesn't actively manage the spinner itself (which is optional).

Furthermore, the final status message is printed even if the spinner was never started. This is carried over from the old spinners. The spinners are interesting since they do two jobs: showing a spinner while pip does work and displaying the final status of said work.

Finally, the spinners don't necessarily auto-start. The backend hook caller has some extra code to decide whether to spin the spinner, so providing for manual start control was needed.

The overall changes look like this:

  • Add a new non-interactive spinner that uses a background thread to schedule keep-live "still working" messages
  • Add a new no-op spinner for when no status/spinner output is desired. Previously this was achieved by relying on the non-interactive spinner's use of logger.info() which will be hidden automagically. This is clever, but an explicit no-op spinner is IMO cleaner.
  • Simplify the rich spinner a fair bit
  • Add more documentation, comments, and tests for future maintainability and test the (previously untested?) spinner selection logic.
  • ... and finally, delete the old spinners and switch to the new spinners everywhere
  • This migration has the extra benefit of bringing the inprocess build dependency installer's output handling closer to the subprocess installer. I'd never wired a non-interactive spinner for the inprocess installer originally, oops!

    --- a	2026-08-08 18:20:53.977536914 -0400
    +++ b	2026-08-08 18:21:00.906592918 -0400
    @@ -1,5 +1,7 @@
     Obtaining file:///home/ichard26/dev/oss/pip
    -  Installing build dependencies ... done  Checking if build backend supports build_editable: started
    +  Installing build dependencies: started
    +  Installing build dependencies: finished with status 'done'
    +  Checking if build backend supports build_editable: started
       Checking if build backend supports build_editable: finished with status 'done'
       Getting requirements to build editable: started
       Getting requirements to build editable: finished with status 'done'
    @@ -12,7 +14,7 @@
       Building editable for pip (pyproject.toml): started
       Building editable for pip (pyproject.toml): finished with status 'done'
       Created wheel for pip: filename=pip-26.3.dev0-py3-none-any.whl size=39980 sha256=9663b0ea135b304414b54d11e916f1cb0a65e144751e995308f888e5088289d0
    -  Stored in directory: /tmp/pip-ephem-wheel-cache-ytpulo34/wheels/02/b2/7b/cd44cb77bc4424b9ddde1ee0abd178e67d530bdc69f13f7fde
    +  Stored in directory: /tmp/pip-ephem-wheel-cache-8ozfu0o2/wheels/02/b2/7b/cd44cb77bc4424b9ddde1ee0abd178e67d530bdc69f13f7fde
     Successfully built pip
     Installing collected packages: six, pip
    

    ---

    Towards https://github.com/pypa/pip/issues/9081, and supersedes and closes https://github.com/pypa/pip/pull/14026.

    [!tip]

    This is easier to review in the split diff viewer.

    Diff: 431 lines (+323 / -108) across 5 files Reviewer: ichard26 Review duration: 168347m
    All Vouch review confidence checks passed
    Residual risk 0.31 = Change Risk (0.52) × (1 − Review Confidence (0.41)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 431 lines diff across 5 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    40%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.363
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #14238"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 40.9% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52.2% (MEDIUM) · Higher = larger blast radius
    52.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 40.9% · Lower = rushed or shallow review
    40.9%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 30.8% · Safe to merge
    30.8%
    Repository