Yaap

    Yaap is a straight up port of python venerable tqdm to .NET / CLR

    Yaap stands for Yet Another ANSI Progressbar

    Feel free to browse some of the articles like the Getting Started page, FAQ or figure out how to get the best looking progress bar under Windows, alternatively consule the API docs

    What does it do

    Much like in python, Yaap can make .NET loops, IEnumerables and more show a smart progress meter.

    Here's what Yaap's own Demo looks like:

    • Simple Yaap
    • Colored Yaap
    • Paused/Stalled
    • Nested
    • Multi-threaded
    • Simple Yaap
    • Colored Yaap
    • Paused/Stalled
    • Nested
    • Multi-threaded
    using static Yaap.YaapConsole;
    using static Enumerable;
    ...
    foreach (var i in Range(0, 200).Yaap(settings: 
        new YaapSettings {Description = "regular", Width = 100})) {
        Thread.Sleep(100);
        switch (i) {
            case 50: WriteLine("The (re)drawing of the progress bar, happens in the background"); break;
            case 100: Write("As long as you use YaapConsole.Write* methods...."); break;
            case 150: WriteLine(" ... you can continue writing to the terminal"); break;
        }
    }
    
    using static Enumerable;
    ...
    foreach (var i in Range(0, 200).Yaap(settings: new YaapSettings { 
        Description = "regular", 
        Width = 100, 
        ColorScheme = YaapColorScheme.Bright}))
        Thread.Sleep(100);
    
    using static Enumerable;
    
    var yaap = Range(0, 2000).Yaap(settings: new YaapSettings {
        Description = "regular",
        Width = 100,
        ColorScheme = YaapColorScheme.Bright,
        SmoothingFactor = 0.5,
    });
    
    foreach (var i in yaap) {
        ...
        yaap.State = YaapState.Paused;
        ...
        yaap.State = YaapState.Running;
        ...
        yaap.State = YaapState.Stalled;
        ...
        yaap.State = YaapState.Running;
    }
    
    foreach (var i in Range(0, 3).Yaap(settings: new YaapSettings { 
        Description = "nested1", UseMetricAbbreviations = true }))
        foreach (var j in Range(0, 10).Yaap(settings: new YaapSettings { 
            Description = "nested2", UseMetricAbbreviations = true }))
            foreach (var k in Range(0, 100_000_000).Yaap(settings: new YaapSettings {
                Description = "nested3", UseMetricAbbreviations = true }))
                ; // Oh, just do nothing here
    
    
    using static Enumerable;
    
    var threads = Range(0, 10).Select(ti => new Thread(() => {
        var r = new Random((int) (DateTime.Now.Ticks % int.MaxValue));
        
        foreach (var i in Range(0, 200).Yaap(settings: new YaapSettings {
          Description = $"thread{ti}", VerticalPosition = ti }) {
          Thread.Sleep(r.Next(90, 110) / (ti + 1));
    })).ToList();
        
    foreach (var t in threads) t.Start();
    

    What is a Yaap made of

    What Else

    Yaap has the following features:

    Feature Blurb
    Easy wrapping of IEnumerable<T> with a Yaap progress bar foreach (var i in Enumerable.Range(0, 1000).Yaap()) { }
    Manual (non IEnumerable<T>) progress updates var y = new Yaap(100); y.progress = 99;
    Low latency (~30ns) on enumeration Generally speaking, everything happens in background thread, and the enumeration is un-hindered
    Checkout the benchmarks
    Zero allocation (post construction) What can I say, I just really hate alloactions
    Checkout the benchmarks
    Full progress bar with smooth unicode and numeric progress, time and rate Yaap will detect unicode support and will opt to use the default unicode block charchter based theme, but you can use additional unicode themes using the provided BarStyle enumeration if you are a special snowflake
    When unicode is not supported by the terminal, we us the plain ole' # char
    Elapsed time tracking / Total Time Prediction Yaap will time the elapsed time and predict the remaining time
    No-Embarrassment guarantee


    or your money back**
    Yaap will never make you lose face with showing embarrassing things like 101% completion, or having the elapsed time go past the predicted time (Instead we'll keep changing the predicted time!)
    Rate Prediction Uses advanced machine learning to predict total estimated time (team available for acquihire)1


    1 OK, I lied, Just using Kalman filters effectively instead
    Metric Abbreviation for counts (K/M/G...) Yaap can automatically use metric units (K/M/G)
    Nested / Multiple concurrent progress bars Yaap will automatically detect nested progress bars with no extra effort on your part
    Colors Yaap can do normal 16 color palette or force TrueColor in case someone redifined yellow in their infinite wisdom
    Butter Smooth Progress bars Yaap can predict progress from rate, allowing smooth progress bars, even on slow/choppy enumeration
    Butter Smooth Nested Progress bars Yaap can estimate progress in higher level loops from the progress of their sub-loops(!)
    Yaap will NEVER .Count() your IEnumerable Yaap never calls .Count(). It does other ungodly things to try and get your IEnumerable "length" in weird/undocumented ways, and when all fails, it will miserably fail, asking you to provide the Total value anagrammatically
    Turn elements on/off
    Works on Windows But you have to work for it, at least bit
    Dynamic Resizing
    Constant Width
    • Improve this Doc
    Back to top © Copyright 2018 Dan Shechter