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
Automatic units in monitor for large quantities #43
Comments
Hello @lschmelzeisen! I'm not sure I understand it, you would like to see numbers divided by 1000, with suffixes of kilo, mega, etc? So, instead of:
Are you asking for this?
Aren't we losing too much information by truncating it all?
If it really is what you're asking, I don't know if it would be that useful, as I'm not comfortable in truncating and reducing information, and also don't think it would be a popular feature for that.
which would become:
Would by any chance be that what you're looking for? |
Sorry, I imaged you would be familiar with tqdm, so let me elaborate a bit. The idea of the
With
(Of course than the bar would also need to be shortened by two characters to fit into the number of available columns, but I didn't bother to do this in these examples.) With
(Here is the tqdm implemenation of this scaling.) I concede that this probably isn't too useful for such small numbers. However, my main use case for progress bars is iterating over large files (up to multiple GBs large). There such an automatic unit scaling behavior is very convenient. For One other way you could look at this would be that currently there is no way to customize the text next to the bar (I think, have only looked at the README not your code). So you could also just add a callback with a default implementation like the following to allow users to implement this themselves if desired:
which would then be called on each bar update with parameters like this:
(Could be that I'm simplifying too much here, as I didn't look at the code yet, sorry.) |
Hey @lschmelzeisen, thanks for the more detailed explanation. It's just that my plate is too full at this moment, I'm implementing a big refactoring in
Well, that's about it, you see that there's several cool things on the horizon, but I'll get there!... 😅 And about the text next to the bar, you sure can customize it. You can send a default one |
Sure, it's your project and you get to decide where to spent your time. Looking forward to see how this will develop in the future! |
Hey @lschmelzeisen, how are you man? Just to let you know I've changed my plate, and I'll implement this for you after 2.0! |
Hi @rsalmei, I'm also very interested in this feature (this is the only thing keeping me from migrating some of my projects from |
Hey @jhonatan-lopes! I'm working on it! I do not have much free time, but I've started this feature 👍 |
Wow, it's already working in |
Hey @lschmelzeisen and @jhonatan-lopes, question: I'm thinking... If I sent a "unit" like In short, I think I could implement both the "unit" and "scaling with SI-prefixes" using just one configuration: |
Hi @rsalmei, I see what you mean, but consider the following scenarios:
With all that said, I do think that the two configurations are needed, both It could be that the default is that when What do you think? |
Thanks, @jhonatan-lopes. I think it is almost that... Your first and second scenarios are actually the same, where we do have auto-scaling when the unit is given (regardless of the divisor). The third is the one I do not think would be very needed: with the unit given but disabling auto-scaling... But OK, I can make them separate, and give 👍 |
For the configuration, we have:
I've also created a new factory that accepts some fixed options with aliases, so:
And the cherry on top, I'm implementing a help system for configuration errors: with alive_bar(..., scale=2) as bar:
...
---------------------------------------------------------------------------
...
ValueError: Invalid config value: scale=2
Expected one of: (None, '2', '2_iec', '10', False, True) |
is there a pre-release to use this feature?:eyes: |
Hey @Jasonzyt, not yet, I couldn't even commit it yet! |
Hey folks, it is committed, and I'm about to release it... |
Would it be possible to support automatic unit conversion, similar to how tqdm implements this?
The text was updated successfully, but these errors were encountered: