Add rich based spinner#13451
Merged
Merged
Conversation
The benefit of this spinner over our legacy spinners is that Rich will update and render the spinner automatically for us. This is much nicer than having to call .spin() manually.
af966e4 to
ea7634a
Compare
notatallshaw
approved these changes
Jul 17, 2025
notatallshaw
left a comment
Member
There was a problem hiding this comment.
This looks good.
I would be tempted to rename PipRichSpinner to _PipRichSpinner to make it clear it shouldn't be accessed externally.
Also because the PipRichSpinner is running in a thread, if somehow something other than Live called render or finish there could be thread safety issues, but because the context manager doesn't even return the Live object I think this should never happen.
Member
Author
|
There are two ways thread safety issues can arise:
In addition, this code is going to be rolled out in a opt-in basis so there are unexpected issues, they can be addressed at a later point. Thanks for the review! |
sepehr-rs
pushed a commit
to sepehr-rs/pip
that referenced
this pull request
Jul 19, 2025
The benefit of this spinner over our legacy spinners is that Rich will update and render the spinner automatically for us. This is much nicer than having to call .spin() manually.
pelson
pushed a commit
to pelson/pip
that referenced
this pull request
Jul 20, 2025
The benefit of this spinner over our legacy spinners is that Rich will update and render the spinner automatically for us. This is much nicer than having to call .spin() manually.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Broken out of #13450. Our legacy spinners can't be used for that PR because they require that their
spin()method is called manually (and thus are only really functional with the subprocess utility). Instead, let rich handle the updates in the background for us.Can be tested manually like so: