Rust implementation of Python command line progress bar tool tqdm.

Related tags

Command-line tqdm
Overview

tqdm

Rust implementation of Python command line progress bar tool tqdm.

From original documentation:

tqdm derives from the Arabic word taqaddum (تقدّم) which can mean "progress," and is an abbreviation for "I love you so much" in Spanish (te quiero demasiado).

Instantly make your loops show a smart progress meter - just wrap any iterable with tqdm(iterable), and you're done!

demo

This crate provides a wrapper Iterator. It controls multiple progress bars when next is called.

Most traits are bypassed with auto-dereference, so original methods can be called with no overhead.

Usage

Just wrap anything that implements the Iterator trait with tqdm

use tqdm::tqdm;
for i in tqdm(0..10000) {
  ...
 76%|███████████████▉     | 7618/10000 [00:09<00:03, 782.14it/s]

Expose trait to allow method chaining

use tqdm::Iter;
for i in (0..).take(10000).tqdm().style("balloon") {
  ...
 47%|**********.          | 4792/10000 [00:06<00:06, 783.39it/s]

Multi-threading is also supported!

use tqdm::tqdm;
use std::thread;
for t in (0..3) {
  thread::spawn(move || {
    for i in tqdm(0..).style(...) {
      ...
 38%|##########0               | 77/200 [00:00<00:01, 83.24it/s]
 77%|████████████████████      | 77/100 [00:00<00:00, 83.24it/s]
 19%|*****.                    | 77/400 [00:00<00:03, 83.24it/s]

For more usage, please refer to doc

You might also like...
Command-line HTTP client for sending a POST request to specified URI on each stdin line.

line2httppost Simple tool to read lines from stdin and post each line as separate POST request to a specified URL (TCP connection is reused though). G

FTL Rust Demangler is a command-line tool for demangling symbol names that are mangled with the Rust convention

FTL Rust Demangler is a command-line tool for demangling symbol names that are mangled with the Rust convention. It takes a mangled symbol name as input and returns the demangled name

A tool crate to quickly build rust command line application.

Falsework A tool crate to quickly build rust command line application.

Command line tool for cheap and efficient email automation written in Rust

Pigeon Pigeon is a command line tool for automating your email workflow in a cheap and efficient way. Utilize your most efficient dev tools you are al

Command-line tool to generate Rust code for Google Cloud Spanner

nene nene is a command-line tool to generate Rust code for Google Cloud Spanner. nene uses database schema to generate code by using Information Schem

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust
A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust

A standalone Command Line Interface debugging tool for The Witcher 3 written in Rust. This tool is intended for Witcher 3 modders who make mainly scri

A command line tool, manage your hundreds of repository, written with Rust

A command line tool, manage your hundreds of repository, written with Rust

A Rust command line tool to simplify embedded development and deployment.

Bobbin-CLI bobbin-cli is a tool designed to make it easy to build, deploy, test and debug embedded devices using a unified CLI. bobbin-cli understands

A command line tool and Rust library for working with recombination maps.

RecMap library (and command line tool) for reading and working with recombination maps in Rust A RecMap object can be created from reading in a HapMap

Comments
  • Inconvenient behaviour in for loops

    Inconvenient behaviour in for loops

    It is a common pattern in Python to wrap the iterator in a for loop with tqdm like so:

    for _ in tqdm(iter):
        ...
    

    This Rust version of tqdm advances the progress bar when calling .next(), which makes sense in principle.

    However, say the iterator is trivially fast (like a Vec) and the slow computation is within the for loop, then the progress bar will tick from 0 to 1 almost immediately, and take a lot longer to go from 1 to 2 and so on. This causes the ETA to be vastly underestimated since it is artificially reduced by that first false iteration.

    The original tqdm seems to somehow avoid this, it stays at zero until the first for loop has completed. Is there a clean way to address this flaw in such a common pattern?

    opened by oersted 3
  • fix docs on how to specify styles

    fix docs on how to specify styles

    It looked like this part of the modification was not applied to the README, so I fixed it .

    • https://github.com/mrlazy1708/tqdm/commit/674cce1b669fc79e67669a153d2d56d5c686858a#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R296-R317

    If it looks OK, please merge it in.

    Thanks for maintaining this crate 😄.

    opened by Kanatani28 1
  • print progress to stderr instead of stdout

    print progress to stderr instead of stdout

    changed all instances of stdout to stderr

    I think this is the better default behavior as it's the default behavior of the python-tqdm relevant source, and as explained why here

    a follow-up PR I want to open will be to add file to the config struct so we could configure the destination of the progress bar instead. But I will wait for your approval first.

    thank you for maintaining this crate 😄

    opened by MeitarR 1
A command line progress reporting library for Rust

indicatif Documentation A Rust library for indicating progress in command line applications to users. This currently primarily provides progress bars

Armin Ronacher 3.2k Dec 30, 2022
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
A toy example showing how to run Rust code in Python for speed and progress.

PoC: Integrating Rust in Python A toy example showing how to run Rust code in Python for speed and progress. Requirements Python 3.6+ Rust 1.44+ Cargo

Emil Thorenfeldt 2 Feb 7, 2022
A Command-line tool to create, manage and deploy your python projects

PPM A Command-line tool to create, manage and deploy your python projects Table of Contents PPM Main Features Create a Project project.ini file Projec

FUSEN 6 Aug 30, 2022
Pink is a command-line tool inspired by the Unix man command.

Pink is a command-line tool inspired by the Unix man command. It displays custom-formatted text pages in the terminal using a subset of HTML-like tags.

null 3 Nov 2, 2023
This is a simple command line application to convert bibtex to json written in Rust and Python

bibtex-to-json This is a simple command line application to convert bibtex to json written in Rust and Python. Why? To enable you to convert very big

null 3 Mar 23, 2022
A command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects.

CCake CCake is a command line tool written in Rust and designed to be a modern build tool + package manager for C/C++ projects. Goals To be easily und

Boston Vanseghi 4 Oct 24, 2022
A Content Discovery Tool insipired from Feroxbuster. Work In Progress

monologue A Content Discovery Tool written in Rust, insipired from Feroxbuster. Installation Dependencies OpenSSL (If You are on linux). Rust programm

Voyage 3 Jul 20, 2023
Rust Imaging Library's Python binding: A performant and high-level image processing library for Python written in Rust

ril-py Rust Imaging Library for Python: Python bindings for ril, a performant and high-level image processing library written in Rust. What's this? Th

Cryptex 13 Dec 6, 2022