I'm using tqdm to display progress bars while some long-running Django management commands complete. It works great (so easy to use!), but...
When I run unit tests over my code, I want to stop the progress bars from outputting. And if I run those commands in the background using cron or some other means, I'd also want the progress bars not to be in the output.
I can't see an easy way to do these two things, but perhaps I've missed something?
There is a disable
argument which you can set to True
to silence any tqdm
output (and in fact it will totally skip the progress bar calculations too, not just the display).
To dynamically switch it, you can just add a commandline argument to your script that will define if disable
is set or not. This should work for both unit testing and cron.