Community Python Snippet

A stdout Progress Bar Without a Library (Python)

tqdm is wonderful but adds 30k of dependencies for a 30-line job. Here is the pure-stdlib progress bar I drop into ETL scripts when I just want to know how far through the file I am.

A stdout Progress Bar Without a Library (Python)

tqdm is wonderful but adds 30k of dependencies for a 30-line job. Here is the pure-stdlib progress bar I drop into ETL scripts when I just want to know how far through the file I am.

Python
Compiler
3 snippets
input-output
code-template
py-generators
rajtanaka

By @rajtanaka

March 31, 2026

·

Updated May 20, 2026

359 views

8

Rate

Three small choices keep this honest. The redraw throttle (0.05s) means the bar updates at 20fps regardless of how fast the loop is, so a hot loop does not pay a syscall on every iteration. The TTY check makes the bar collapse into a flat print when output is piped to a file, so log files stay readable. The rate calculation uses elapsed-since-start rather than a windowed estimate, which is slower to react but never produces a 'eta=0.1s' lie when the loop has been running for an hour. I have shipped this in two ETL scripts; the first time anyone needs more (multi-bar, nested progress, byte-rate units) I switch to tqdm and stop pretending.