cta-observatory / ctapipe

Low-level data processing pipeline software for CTAO or similar arrays of Imaging Atmospheric Cherenkov Telescopes
https://ctapipe.readthedocs.org
BSD 3-Clause "New" or "Revised" License
63 stars 266 forks source link

Set disable=None by default for progress bar in ctapipe tools #2444

Open morcuended opened 8 months ago

morcuended commented 8 months ago

Sets tqdm(..., disable=None) in process and merge ctapipe tools.

By default the progress bar is displayed when running the tools in interactive mode. If they are executed in non-tty mode the progress bar is disabled. There is also a command line option --disable-progress to disable it.

I added some tests to check the expected behavior in both tty and non-tty modes.

Closes #2366

morcuended commented 8 months ago

You need to remove the --progress option in a few other tests in test_process.py, I think.

Yes, done. Thanks.

Another potential suggestion (optional): since many people may still have this option in their scripts, maybe deprecating it more gracefully would be nice? e.g. add a --progress option that does nothing except emit a warning that the --progress option is deprecated and no longer needed (and to use --disable-progress to remove the automatic progress bar if necessary). We might want to always do that on changes to top-level command-line options.

Thanks, Good idea. I will do so.

morcuended commented 8 months ago

I tried to implement some tests for disabling the progress bar when using non-tty mode and also that it is displayed automatically in tty mode. But I found no straightforward way to capture the progress bar using, for example, subprocess. If you think tests on this are anyways necessary, we could try to find a way.