-
Notifications
You must be signed in to change notification settings - Fork 10
fix: Replace Halo with rich for CLI spinner and progress tracking #256
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
mercuryseries
left a comment
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.
Thanks, @jstlaurent, for tackling this over your busy weekend! 😉
I think this is the right call. I looked into this after issue #255 and was leaning towards Rich as well. Added a few minor comments here and there, nothing major!
cwognum
left a comment
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.
Thanks @jstlaurent !
Could you show a screenshot of what it now looks like?
Co-authored-by: Honoré Hounwanou <mercuryseries@gmail.com>
Co-authored-by: Honoré Hounwanou <mercuryseries@gmail.com>
|
Thanks for the screenshot @jstlaurent ! Looks great to me! |
Changelogs
Adresses issue #255
Preview
Checklist:
Add tests to cover the fixed bug(s) or the newly introduced feature(s) (if appropriate).Update the API documentation if a new function is added, or an existing one is deleted.feature,fix,chore,documentationortest(or ask a maintainer to do it for you).When used in iPython, Halo raises an exception. The bug has been patched in their repo secven months ago, but no new release has been created since. The last release is more than four years old.
In order to fix this, I elected to use rich, a CLI formatting library that has progress trackers. It is up-to-date and well maintained. I replaced the
ProgressIndicatorclass with a context manager function that wraps aProgressobject fromrich. In addition to a spinner, we also get progress bars. By using a ContextVar, we can nest multipletrack_progresscontext manager, to track multiple tasks.In order not to break the visual output in the CLI, I also used the logging handler provided by
rich, replacing the Loguru library we had been using. I also took the opportunity to scope the logging configuration to the Polaris library logging only, to avoid changing any config the user might have set up in their code.