Skip to content
vic

ericentin/tqdm_elixir

Add a progress bar to your enumerables in a second

ericentin/tqdm_elixir.json
{
"createdAt": "2015-12-23T17:49:13Z",
"defaultBranch": "master",
"description": "Add a progress bar to your enumerables in a second",
"fullName": "ericentin/tqdm_elixir",
"homepage": null,
"language": "Elixir",
"name": "tqdm_elixir",
"pushedAt": "2023-08-25T17:39:03Z",
"stargazersCount": 58,
"topics": [],
"updatedAt": "2024-04-07T09:31:34Z",
"url": "https://github.com/ericentin/tqdm_elixir"
}

Build Status Coverage Status Inline docs Hex.pm package version Hex.pm package license

Tqdm easily adds a CLI progress bar to any enumerable.

tqdm

A (partial) port of Python’s tqdm to Elixir. Thanks noamraph and all other contributors for the original library!

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(total: 1000)
|> Stream.run()
# |###-------| 392/1000 39.0% [elapsed: 00:00:04.627479 left: 00:00:07, 84.71 iters/sec]

Full documentation can be found here.

  1. Add tqdm to your list of dependencies in mix.exs:
def deps do
[{:tqdm, "~> 0.0.2"}]
end
  1. Ensure tqdm is added to your list of applications:
def application do
[applications: [:tqdm]]
end