-
Notifications
You must be signed in to change notification settings - Fork 108
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
node: Improve live progress output (and other small tweaks) #315
base: master
Are you sure you want to change the base?
Conversation
There is a plenty or ready-made "progressbar" libs, honestly I'd prefer to use one of those instead of implementing (or extending) our own. |
Right, so I actually started out using tqdm but ended up removing it, because as it turns out, I didn't actually want a progress bar, per se, and it definitely wasn't a single line. The main things are that, if you see in the video:
The main loss is honestly time estimates, but given that some packages require extra downloads and such anyway, those weren't super useful. Additionally, although there are a bunch of other libraries...they all seem to be missing something relatively tricky that we'd have to add anyway, most particularly the proper handling of multiple progress bars. Hence, DIY progress bars. (Plus, the code isn't that untested, I ripped the core logic from an old tool in C++ that had multiple lines of progress that would finish at inconsistent intervals. Feel free to try to break it though!) |
Signed-off-by: Ryan Gonzalez <[email protected]>
This upgrades the progress output quite a bit, largely thanks to the rich CLI library: - There's a pretty animation at the start of the line! - Instead of printing the last package interacted with (which made no sense), show as many of the currently-processing packages as can fit on a single line. - Show live download progress for large downloads, so any that are holding up generation don't appears to be hanging. In addition, this adds a hidden CLI flag, --traceback-on-interrupt, that prints a full traceback from every active package coroutine on Ctrl-C, which was useful while debugging this (and probably will be in the future!) Signed-off-by: Ryan Gonzalez <[email protected]>
8a618db
to
954f103
Compare
So as it turns out, there is a nice library that does what I need, it's just not marketing as a progress library: Rich. It also gives some very fancy and nice progress bars! So, the current output is: Screencast.from.2022-12-16.16-44-59.webm(ignore the random frame drops at the 0:07 and 0:14 mark, no idea what those are from) Ideally I'd like to add some colors which Rich makes relatively easy, but this is already a big improvement and that can be added later. |
Second commit message has the basic summary:
Live demo (with a weirdly low framerate, but it actually looks smooth live, not sure why it was being weird here):
Screencast.from.08-26-2022.05.59.29.PM.webm
This may or may not have taken like, 6 hours to figure out. (Terminals are hard.)