As part of a long pipeline (all orchestrated in Python), I'm calling an external program using the subprocess module. This program takes a while to finish, so I'd like to show the user a nice progress bar, to reassure them that it hasn't frozen.
This program also sends a whole lot of information to stdout—much more than I want to show the end user. But the number of lines in this output is consistent.
What's the best way to track the number of lines that have been sent to stdout by a subprocess, for the purpose of updating a real-time status bar (via tqdm)?