Giter VIP home page Giter VIP logo

tqdm's People

Contributors

aubrey-liu avatar marokanatani avatar meitarr avatar mrlazy1708 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

tqdm's Issues

No Windows support

tqdm is not supported in Windows due to using termion as a dependency. crossterm is the recommended alternative with has a similar API.

Add minimum rust version to Cargo.toml

error[E0015]: cannot call non-const fn `std::sync::Mutex::<Vec<std::sync::Arc<std::sync::Mutex<Info>>>>::new` in statics
   --> /home/USER/.cargo/registry/src/github.com-1ecc6299db9ec823/tqdm-0.4.3/src/lib.rs:306:45
    |
306 | static TQDM: Mutex<Vec<Arc<Mutex<Info>>>> = Mutex::new(Vec::new());
    |                                             ^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: calls in statics are limited to constant functions, tuple structs and tuple variants

For more information about this error, try `rustc --explain E0015`.

This crate does not compile due to the error above.

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?

Add a "tqdm.write" like method

Currently, if I want to print some information within the loop, there will be something like:

for i in tqdm(x.iter()) {
  // do something
  println!("anything");
}

However, this println will interfere with the progress bar, and it's like:

Screenshot 2023-04-04 at 15 08 05

and a desirable output will be like:

Screenshot 2023-04-04 at 15 10 23

Therefore, print the message through a tqdm.write method might be a good idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.