-
Notifications
You must be signed in to change notification settings - Fork 557
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
Replace halo spinner with rich #2086
Conversation
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.
Please add bug fixes, new features, breaking changes and anything else you think is worthwhile mentioning to the master (unreleased)
section of CHANGELOG.md. If no CHANGELOG update is needed add the following to the PR description: [x] No CHANGELOG update needed
CHANGELOG updated or no update needed, thanks! 😄
does the rich |
we can test by having an active spinner (or rich progress bar) and also writing to the output stream directly, and then observing if the spinner is correctly cleaned up/rendered near the new lines. |
- remove Halo dependency - update CHANGELOG.md - add documentation on rich.console.Console
I did an expriment for this, and concluded that Test if rich.console can be mixed with raw prints to stderrimport sys
import time
from rich.console import Console
console = Console(stderr=True)
with console.status("Spinner...", spinner="dots"):
time.sleep(1)
print("This text is printed to stdout")
time.sleep(1)
print("This text is printed to stderr", file=sys.stderr)
time.sleep(1) Does this answer your question @williballenthin? |
wow that's great! thanks @s-ff! |
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.
please also remove the halo entry from .github/mypy/mypy.ini
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.
awesome, thanks!
This PR is a candidate replacement for Halo spinner as discussed in #1812. It uses Rich module.
If we end up adopting rich, we could maybe use some of its other features to reduce dependencies, for example replacing
tqdm
withrich.progress
andtabulate
withrich.table
. It could also serve to implement a pager functionality for long output texts.Checklist