tqdm v0.0.2 Tqdm
Tqdm easily adds a CLI progress bar to any enumerable.
Just wrap Lists, Maps, Streams, or anything else that implements Enumerable
with Tqdm.tqdm:
for _ <- Tqdm.tqdm(1..1000) do
:timer.sleep(10)
end
# or
1..1000
|> Tqdm.tqdm()
|> Enum.map(fn _ -> :timer.sleep(10) end)
# or even...
1..1000
|> Stream.map(fn -> :timer.sleep(10) end)
|> Tqdm.tqdm()
|> Stream.run()
# |###-------| 392/1000 39.0% [elapsed: 00:00:04.627479 left: 00:00:07, 84.71 iters/sec]
Summary
Functions
Wrap the given enumerable and print a CLI progress bar
Types
Functions
Specs
tqdm(Enumerable.t, options) :: Enumerable.t
Wrap the given enumerable and print a CLI progress bar.
options may be provided:
:description- a short string that is displayed on the progress bar. For example, if the string"Processing values"is provided for this option:# Processing values: |###-------| 349/1000 35.0% [elapsed: 00:00:06.501472 left: 00:00:12, 53.68 iters/sec]:total- by default,Tdqmwill useEnum.countto count how many elements are in the givenenumerable. For large amounts of data, or streams, this may not be appropriate. You can provide your own total with this option. You may provide an estimate, and if the actual count exceeds this value, the progress bar will change to an indeterminate mode:# 296 [elapsed: 00:00:03.500038, 84.57 iters/sec]You can also force the indeterminate mode by passing
0.:clear- by default,Tqdmwill clear the progress bar after the enumeration is complete. If you passfalsefor this option, the progress bar will persist, instead.:device- by default,Tqdmwrites to:stderr. You can provide anyIO.deviceto this option to use it instead of the default.:min_interval- by default,Tqdmwill only print progress updates every 100ms. You can increase or decrease this value using this option.:min_iterations- by default,Tqdmwill check if the:min_intervalhas passed for every iteration. Passing a value for this option will skip this check until at least:min_iterationsiterations have passed.:total_segments- by default,Tqdmwill split its progress bar into 10 segments. You can customize this by passing a different value for this option.