progress_bar¶
- toasty.progress.progress_bar(total=None, show=None)[source]¶
Create and return a TQDM progress bar.
- Parameters:
- totalint
The total number of items to be processed.
- showbool
Whether the progress bar should actually be shown.
- Returns:
- A
tqdm
progress bar instance.
- A
Notes
The progress bar will be customized to be emitted much less frequently when standard output is not a terminal. It will also print newlines with every update, which makes log files much easier to review.
Terminal-style output will be used even when standard output is not a terminal, if the environment variable
JPY_PARENT_PID
is set. This variable is set inside Jupyter kernel processes, and in those circumstances stdout is a pipe but we probably still want to use the terminal-like progress bar output.