rsalmei / alive-progress

A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
MIT License
5.53k stars 206 forks source link

[FR] - Option to not print final result #120

Closed bobokun closed 2 years ago

bobokun commented 2 years ago

Sorry if I missed this option, but I wasn't clear if it is currently possible to choose not to print out the final bar once it reaches 100%. I would like to able to see the progress bar but once it's complete it does not stay in the terminal and the bar disappears completely

TheTechRobo commented 2 years ago

Try this? https://github.com/rsalmei/alive-progress/issues/72#issuecomment-757506351

bobokun commented 2 years ago

I tried to set the config but it doesn't solve the problem. config_handler.set_global(bar=None, receipt_text=False) After completion it still shows the final output printed out image

I'm using the alive_it function

TheTechRobo commented 2 years ago

What's your code?

bobokun commented 2 years ago

Here's an example code

from alive_progress import alive_it, config_handler
import time

config_handler.set_global(bar=None, receipt_text=False)

test = (range(100))
test2 = (range(50))
for x in alive_it(test):
  time.sleep(0.1)
for x in alive_it(test2):
  time.sleep(0.1)

Output:

100/100 [100%] in 10.0s (9.96/s)
50/50 [100%] in 5.0s (9.95/s)

I would like no output to be shown once it reaches 100%

rsalmei commented 2 years ago

Hello @bobokun,

No, there isn't an option to completely ignore the final receipt. As you have seen, the option you've tried is called receipt_text, i.e. it removes or shows the last situational text you may have set while the bar was running.

No one has ever asked this, but it should be easy enough to support. Just the new config parameter for this could maybe give some trouble, but I can do it eventually. At the moment I'm very involved with Rust and a new job I've recently started.

bobokun commented 2 years ago

Great thank you!

rsalmei commented 2 years ago

Hello @bobokun, I'm glad to inform you this is ready! I should be releasing it today, if everything goes OK.

Untitled

bobokun commented 2 years ago

Is this available for me to test in a branch or is the release coming soon?

rsalmei commented 2 years ago

Not yet, but the release is very soon! I ended up implementing a bunch of other stuff together with this, so I'm polishing them up and then write the readme and changelog. I'll probably release it tomorrow.

rsalmei commented 2 years ago

Hey, it is released! #131 Take a look at the new readme for details! 🎉

bobokun commented 2 years ago

Thanks! It's working perfectly :)

rsalmei commented 2 years ago

That's great to hear!! 😃 You're welcome!

takanuva15 commented 1 year ago

For anyone in the future who comes here trying to figure out how to not show the final bar when the progress completes, just add receipt=False to the keyword arguments in the alive_bar method. ie: with alive_bar(receipt=False):

(Also I just discovered this library today and it's one of the most legit things I've ever seen in Python!)

rsalmei commented 1 year ago

Thanks, man 👍