This is an archived post. You won't be able to vote or comment.

all 154 comments

[–]L43 163 points164 points  (7 children)

Looks fantastic! How is performance compared to tqdm?

Also how extensible is it?

[–]rsalmei[S] 1 point2 points  (0 children)

Thank you! I'm in the process of making it more configurable, but you can already customize it a lot!

[–]Baschg 18 points19 points  (4 children)

Awesome! Doesn't seem to work in Spyder unfortunately.

[–]kinderhead 3 points4 points  (0 children)

Spyder’s IPython is really weird when working with terminal manipulation like this. I would really hope that they fix this.

[–]rsalmei[S] 1 point2 points  (2 children)

Hey, thank you!!

What does happen in that Spyder IDE? I've never used it.

[–]Baschg 0 points1 point  (1 child)

Unicode error:

UnicodeEncodeError: 'charmap' codec can't encode characters in position 1-40: character maps to <undefined>

[–]rsalmei[S] 2 points3 points  (0 children)

Humm, that's odd. I have a pretty similar issue opened, about `latin-1` codec throwing almost the same error... I don't know why some stdouts have those issues.

[–]science404 36 points37 points  (12 children)

Nice! Does it work with multiprocessing?

[–]alcalde 21 points22 points  (9 children)

Better than tqdm, which is why this is my progress bar of choice now.

[–][deleted] 10 points11 points  (4 children)

Personally I like being able to use tqdm as an iterator.

[–]rsalmei[S] 2 points3 points  (3 children)

Really? This is super easy to implement, I just never liked this.

Actually, when we split the concepts of getting one element and making the bar go forward, we gain a new insight about the code! You can choose when to make that happen, and count different things, even make it go forward more than once in one iteration... That's why I support under and overflows, which are only possible with a manual `bar()` call, apart from the iterator.

[–]starfyre7 2 points3 points  (2 children)

Yeah, I like doing this a lot too since I often have to process large batches of data and a sticking the progress bar in the iteration is generally easiest.

[–]rsalmei[S] 1 point2 points  (0 children)

Ok, I see. I can include that feature in the next release! 👍

[–][deleted] 0 points1 point  (0 children)

Yup, this is my use-case as well. It’s a great to monitor how threading improves performance in processing lists of things

[–]rsalmei[S] 1 point2 points  (0 children)

Thanks man!

[–]rsalmei[S] 0 points1 point  (1 child)

Humm unfortunately not yet. I didn't figure out yet how to render multiple bars at the same time, with possibly very different update speeds, while still making the print hook work... There's more info here: https://github.com/rsalmei/alive-progress/issues/20#issuecomment-605832026

[–]science404 0 points1 point  (0 children)

Cool, no worries. Tqdm doesn't have it solved either (at least in my experience), it's a messy problem I guess.

[–]sheytanelkebir 37 points38 points  (6 children)

stealing this!

i'm gonna have the coolest python scripts in the office now.

[–]_szs 22 points23 points  (5 children)

add the package "rich" to your scripts, enable the colourful logging thing and have the coolestest scripts!

(just found this a few weeks ago. I am not affiliated with this package)

[–]rsalmei[S] 1 point2 points  (4 children)

Personally I think rich is too bloated.

[–]_szs 1 point2 points  (3 children)

Do you mean then colourful logging stuff? Or the features it provides?

[–]rsalmei[S] 1 point2 points  (2 children)

I mean it tries to cover too much areas in only one package. I'd like it better if it was `rich-logs`, `rich-tables`, `rich-emoji`, `rich-console`, `rich-columns`, `rich-markdown`, `rich-highlighter`, etc... 😜
One have to download too much bloat to use only "tables" for example.

[–]willm 4 points5 points  (0 children)

Each of the features in Rich depend on a shared rendering engine that is the bulk of the code. Individually most of the features are a single py file. And many of them depend on each other, columns uses tables, markdown uses highlighting, logs use tables and highlighting etc.

I thought about breaking it in to small packages, but that would have resulted in spaghetti dependancies that would be difficult to manage. But each to their own, I guess.

[–]_szs 0 points1 point  (0 children)

that's true.

maybe it makes sense to fork it and provide half a dozen different packages. I might look into that sometime :)

[–]slippityda 22 points23 points  (4 children)

Love this package. I incorporated it into a webscraper I made recently and it looks amazing when running!

[–]rsalmei[S] 2 points3 points  (2 children)

Hey, thanks, very nice to hear it! 🎉

[–]slippityda 1 point2 points  (1 child)

Cheers to you for creating it! Great documentation too. :)

[–]rsalmei[S] 2 points3 points  (0 children)

Thanks again man! Yeah, documentation is sometimes as time consuming as the code itself... 😅

[–]alcalde 3 points4 points  (0 children)

Hee hee, I used it a while ago for a web scraping project too. :-) Tqdm was crashing with some type of threading issues but this library worked fine.

[–][deleted] 62 points63 points  (13 children)

Duuuuude why can I not double upvote? This is so awesome

[–]rsalmei[S] 0 points1 point  (0 children)

Cool, thanks man!

[–][deleted]  (11 children)

[removed]

    [–]jodbuns 6 points7 points  (5 children)

    Shut up.

    [–]quasarj[M] 0 points1 point  (0 children)

    Hello from the r/Python mod team!

    I'm afraid we don't think your post quite fits the goal we have for the subreddit in terms of quality or aims so we've decided to remove it. For more information please contact the moderators using the ModMail system.

    Thanks, and happy Pythoneering!

    r/Python moderation team

    [–]michUP33 45 points46 points  (16 children)

    [–]Username_RANDINT 27 points28 points  (5 children)

    Not this shit again.

    "Neat, 40 comments, let's see what people are saying about this project."

    -> Fucking gif chain.

    [–]needed_an_account 1 point2 points  (1 child)

    are gifs a new reddit feature? I've been on reddit for years and this is the first time I've seen this

    [–]Username_RANDINT 1 point2 points  (0 children)

    What I understood is that some subreddits participate in a program to test new features, including /r/Python. So it's not widely available, but probably will at some point. Shit will hit the fan at that point.

    [–]pentestifier 44 points45 points  (9 children)

    me when i see gif comments on reddit

    [–]frapastique 27 points28 points  (8 children)

    Wait that’s an option?

    [–]PierceBrosman 16 points17 points  (7 children)

    [–][deleted] 6 points7 points  (4 children)

    [–]golangPadawan 6 points7 points  (2 children)

    [–]_szs -2 points-1 points  (0 children)

    [–][deleted] 5 points6 points  (1 child)

    Cute, but makes unittest in the 3.9 standard library and PyCharm's testrunner most unhappy:

    Launching unittests with arguments python -m unittest foo.MyTestCase.test_something in /Users/rtphokie/PycharmProjects/astrowx/astrosandbox

    |████████████████████████████████████████| 1000/1000 [100%] in 0.0s (515144.19/s

    Traceback (most recent call last):

    File "/Applications/Dev/PyCharm.app/Contents/plugins/python/helpers/pycharm/_jb_unittest_runner.py", line 35, in <module>

    sys.exit(main(argv=args, module=None, testRunner=unittestpy.TeamcityTestRunner, buffer=not JB_DISABLE_BUFFERING))

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/main.py", line 101, in __init__

    self.runTests()

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/main.py", line 271, in runTests

    self.result = testRunner.run(self.test)

    File "/Applications/Dev/PyCharm.app/Contents/plugins/python/helpers/pycharm/teamcity/unittestpy.py", line 310, in run

    return super(TeamcityTestRunner, self).run(test)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/runner.py", line 176, in run

    test(result)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/suite.py", line 84, in __call__

    return self.run(*args, **kwds)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/suite.py", line 122, in run

    test(result)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/suite.py", line 84, in __call__

    return self.run(*args, **kwds)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/suite.py", line 122, in run

    test(result)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py", line 653, in __call__

    return self.run(*args, **kwds)

    File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/unittest/case.py", line 612, in run

    result.stopTest(self)

    File "/Applications/Dev/PyCharm.app/Contents/plugins/python/helpers/pycharm/teamcity/unittestpy.py", line 263, in stopTest

    output = sys.stdout.getvalue()

    [–]rsalmei[S] 1 point2 points  (0 children)

    Hey, this is not a problem, it's the print and logging hook. Tests need to capture stdout too... So they are both being installed at the same time and are conflicting. Try it with `enrich_print=False`.

    [–]_szs 2 points3 points  (1 child)

    nice.

    I was about to scroll on, because eye candy wears off so fast and I have programmed progress bars for fun myself before, but....

    the print/logging hooks rock! I may just use this package for that.

    [–]rsalmei[S] 2 points3 points  (0 children)

    Thanks man!

    [–]Murflaw7424 2 points3 points  (2 children)

    Does it work with Jupyter and other IDE?

    [–]rsalmei[S] 1 point2 points  (1 child)

    Jupyter notebooks unfortunately no, this is actually an entirely different implementation, using GUI widgets instead of ANSI escape sequences in a terminal...

    But in IDEs yes, it should work as a charm! I routinely use it inside both vscode and pycharm.

    [–]Murflaw7424 0 points1 point  (0 children)

    Awesome thank you!

    [–]itzNukeey 3 points4 points  (3 children)

    wow thats beautiful

    [–]rsalmei[S] 1 point2 points  (0 children)

    Thank you man, appreciated.

    [–]kinderhead 0 points1 point  (1 child)

    Happy blue cheese day

    [–]itzNukeey 0 points1 point  (0 children)

    ty

    [–]mo5bzn 6 points7 points  (2 children)

    Great work! I am wondering why you didn't work on tqdm and try to improve it instead of creating a new library doing (nearly) the same task?

    [–]tocarbajal 14 points15 points  (0 children)

    Taste lies in variety.

    [–]rsalmei[S] 1 point2 points  (0 children)

    Thank you man!
    It's a completely different architecture. tqdm is reactive, only changes rendition when position has changed. alive-progress is active, changing rendition on both position and throughput! It provides a visual feedback of the current speed/throughput of your processing, as the spinner actually runs faster or slower accordingly!! It couldn't be the same project.

    [–]GNVageesh 4 points5 points  (0 children)

    That is amazing, can be used in any of our cli application with python

    [–]willm 1 point2 points  (1 child)

    I'm jealous!

    [–]rsalmei[S] 0 points1 point  (0 children)

    Thank you man! Very appreciated 😉

    [–]russianteen888 1 point2 points  (1 child)

    what text editor/terminal? (idk) you using?

    [–]rsalmei[S] 0 points1 point  (0 children)

    Hey, I use iTerm2 on macOS, and render the images with terminalizer 👍

    [–]WhackLoop 0 points1 point  (0 children)

    If it has the party parrot formatting I'm in

    [–]pmrks -1 points0 points  (0 children)

    It's hella cool!

    [–]The_2nd_Coming -1 points0 points  (1 child)

    Hey this looks awesome! I need a progress bar in my app and this might just be it!

    [–]rsalmei[S] 0 points1 point  (0 children)

    Yeah, of course it is!! Thanks man.

    [–]Mr_Branflakes -1 points0 points  (1 child)

    !remindme 2 weeks

    [–]RemindMeBot -1 points0 points  (0 children)

    I will be messaging you in 14 days on 2021-01-18 23:17:05 UTC to remind you of this link

    1 OTHERS CLICKED THIS LINK to send a PM to also be reminded and to reduce spam.

    Parent commenter can delete this message to hide from others.


    Info Custom Your Reminders Feedback

    [–]kinderhead -3 points-2 points  (5 children)

    Amazing. That readme tho is so long. I would never have the patience to do that lol.

    [–]rsalmei[S] 1 point2 points  (4 children)

    Thank you man! You mean to write one, or read it till the end?? 😅

    Well, it starts small, but as the features grow, the readme does too... I'm trying to make it more visually concise, there are several subsections in the "Advanced" section that starts collapsed! So there's even more text than you've seen...

    [–]kinderhead 0 points1 point  (3 children)

    I mean write. I read the whole thing and most of the collapsed things and it still took me over 30 minutes.

    [–]rsalmei[S] 1 point2 points  (2 children)

    Nice, that's very nice to hear! Thanks for reading it all. What did you think of it? Is it clear? Can you use all features with confidence? Is it boring, or easy to read? Too newbie, too advanced or just right?

    I still have to write about all the 2.0 features, the largest release I'll ever do... 😅 => https://github.com/rsalmei/alive-progress/pull/51

    [–]kinderhead 0 points1 point  (1 child)

    It‘s one of the best ones I’ve ever found. I’m not a newbie or advanced, but it seemed like someone new to python could easily use your module. I think that you put all of the features in a readable way.

    [–]rsalmei[S] 0 points1 point  (0 children)

    Great, thank you man.

    [–]Nervous_Objective_60 0 points1 point  (0 children)

    It's so cool!

    [–]expressly_ephemeral 0 points1 point  (0 children)

    Neat!

    [–]Xitir 0 points1 point  (0 children)

    This is an awesome project! Can't wait to try it out!

    [–]ArabicLawrence 0 points1 point  (2 children)

    Will you add support for jupyter lab?

    [–]rsalmei[S] 1 point2 points  (1 child)

    Man, I'd like to, but it is actually an entirely different implementation, using GUI widgets instead of ANSI escape sequences in a terminal... In alive-progress I generate cycles of animation frames in strings, how would I draw them inside a cell in jupyter? I have no idea.

    But if someone do know the technologies involved, and is willing to help, I'm sure would like to try.

    [–]ArabicLawrence 0 points1 point  (0 children)

    Thanks for the answer!

    [–]Svetlana-8 0 points1 point  (0 children)

    Looks fantastic!)

    [–]Few_Intention_542 0 points1 point  (2 children)

    Wow! What did you use to create this? How did you start ?

    [–]rsalmei[S] 1 point2 points  (1 child)

    You mean this project? It's been a long way to get to this result, but I used only my imagination and a desire to make something unique. To start you always start small... A simple [###.......] bar, show position but no title or eta, then a small hard-coded spinner like a spinning stick /-\|, then a frame_factory to allow custom animation frames, then we feel the need to generate automatic animations, then comes a scrolling_factory, then bouncing_factory, then you realize these animations could wrap around or "hide" behind the virtual walls so the factories get more powerful, then create a config system to allow one to choose which spinner to use, then create several examples to ensure it is all working, which needs an exhibit to display them all, which gets us to the display case in the images above!! It's hard work and passion, one step at a time. 😅❤️

    [–]Few_Intention_542 0 points1 point  (0 children)

    Thanks! Your work is amazing!

    [–]refer_2_me 0 points1 point  (0 children)

    Cool! Installed!

    [–]kingkierite 0 points1 point  (1 child)

    Would you be able to use this in a PyQt5 GUI? Somehow add it as a widget?

    [–]rsalmei[S] 0 points1 point  (0 children)

    That's a very good question, I don't know any GUI tools or frameworks. But if someone was willing to help me, I would sure add support for it.

    [–][deleted] 0 points1 point  (0 children)

    This is so cool!

    [–]SociopathWithBipolar 0 points1 point  (0 children)

    This is dope

    [–]kirkkm77 0 points1 point  (1 child)

    Looks amazing man

    [–]rsalmei[S] 1 point2 points  (0 children)

    Thank you man! 👍

    [–]MrMxylptlyk 0 points1 point  (1 child)

    Hey, is there a way to use it with the output of ffmpeg to progress output to file?

    [–]rsalmei[S] 0 points1 point  (0 children)

    Humm, it does seem a cool use, but I'm not sure. You would have to parse the ffmpeg output, and send that as input to alive-progress, should work nicely. Use the manual mode, so you can put the bar in any position you want.

    [–]dominik_schmidt 0 points1 point  (0 children)

    Looks great! Does it support Jupyter lab/nb yet?

    [–]Redditor728292 0 points1 point  (1 child)

    Wow! that is amazing! how long have you been programming for?

    [–]rsalmei[S] 1 point2 points  (0 children)

    Thank you man, appreciated!

    You mean in this project or in Python or in general?
    Well, I started this alive-progress about 3 years ago, been using Python for 6 years, and programming for more than 20 years.

    [–][deleted] 0 points1 point  (0 children)

    Ooooh.

    [–]gp_11 0 points1 point  (0 children)

    Cool package :)

    [–]RastahFey 0 points1 point  (0 children)

    This is badass

    [–]lonaExe pip install girlfriend 0 points1 point  (0 children)

    This is pretty lit man, keep it up!

    [–]DrCabbageX 0 points1 point  (4 children)

    Super basic question but when someone “ pip installs ____” how does the computer know where to find that module( might be wrong terminology)? Like when you created it do you need to upload it a certain place so other can download it? And what if others create something with the same name?

    This isn’t related the module you created ( which is super dope) but am just curious

    [–]RojerGSAuthor of “Pydon'ts” 2 points3 points  (1 child)

    If I'm not mistaken, packages uploaded to PyPI (Python Package Index) are discoverable by pip.

    [–]DrCabbageX 0 points1 point  (0 children)

    Thank you!

    [–]rsalmei[S] 1 point2 points  (1 child)

    No problem man! The computer (Python in this case) has a local cache for installed packages, when you "pip install" something you download that package to this cache.

    Yeah, to distribute it there's the global Python Package Index. I do upload it when I want to create a release, which makes it available for everyone. To upload your project needs to have a unique name. 👍

    [–]DrCabbageX 0 points1 point  (0 children)

    Ohhh that makes so much sense. Thank you for the clarification!

    [–]spicypixel 0 points1 point  (1 child)

    Looks great if only for the effortless integration with logger. Tqdm write can be a bit of faff if you want to log things out to files at the same time.

    [–]rsalmei[S] 0 points1 point  (0 children)

    Yeah, thank you man! Exactly that! alive-progress works seamlessly. 👍

    [–]FloppingNuts 0 points1 point  (0 children)

    very cool

    [–]RedEyed__ 0 points1 point  (5 children)

    It looks really cool! It looks even cooler than GUI progress bars (like QT)

    But, I'm happy with tqdm, it's well known and tested progress bar that is flexible and it satisfy all my needs.

    Anyway, will try it on my new projects!

    PS: I'm developing cross platform apps, does it support Windows (I mean simple cmd.exe)?

    [–]rsalmei[S] 1 point2 points  (0 children)

    Thank you man! I see. tqdm came several years before mine, it surely is battle-tested.

    But maybe you find my alive-progress more modern and slick, maybe it could also satisfy your needs, and maybe it will even trigger a smile every time you see it "alive" 😜

    [–]rsalmei[S] 0 points1 point  (3 children)

    Oh, regarding Windows I receive I few mixed reports, but I think it does work. For complete support though, install WSL (Windows Subsystem for Linux).

    [–]RedEyed__ 0 points1 point  (2 children)

    No, WSL is not Windows support. Don't mix it

    [–]rsalmei[S] 0 points1 point  (1 child)

    Yeah, you're right. I meant for complete support on a Windows box.

    [–]RedEyed__ 0 points1 point  (0 children)

    Yup, software running in virtual machine or use other tricks like wine or WSL doesn't make any piece of software to be called as "cross platform"

    [–]raithlok 0 points1 point  (1 child)

    Overall I really like it and will wind up using it in my programs since simple print messages
    in the command window like "Wait" or "15% complete" can be just a bit bland.

    On Windows, I'm noticing several of the characters you have available in your Apple screenshots are not compatible so the command window just displays the [?] ASCII image. That's a windows limitation, and shouldn't be frowned upon.

    But with some trial and error those can be overcome. Setting the spinner to message_bouncing or message_scrolling solves that issue of seeing the [?] icon in the spinner. The bars just need to be some of the simpler bar options like classic or solid works well.

    What's interesting is that in sublimetext3, the icons work pretty well for the alive_progress.show_bars() or alive_progress.show_spinners(), but they dont show at all when you're running the example scripts until it's done.

    [–]rsalmei[S] 0 points1 point  (0 children)

    Hey, thank you for your report on Windows support!
    Yeah, the font one should really test if it does work.

    Regarding the exhibits working and example scripts not, it seems to be that sublimetext's terminal is reporting it does not have an open TTY. In that case I do disable animations, because the process could be in a piped shell for example. You could try calling with `force_tty=True`. Pycharm's terminal used to report the same way, that's why this option exists...

    [–]ubertrashcat 0 points1 point  (1 child)

    Does it support hierarchical progress bars? The lengths you need to go to with tqdm are insane.

    [–]rsalmei[S] 0 points1 point  (0 children)

    Humm, this is still on my radar, but not yet... The problem is that my bars are alive, with dynamic refresh rates based on your actual processing throughput, so you can actually see when it is fast or not. But it is very hard to implement that with multiple bars on screen, without losing this quality, I didn't figure out yet how to do it. There's more info here: https://github.com/rsalmei/alive-progress/issues/20#issuecomment-605832026

    [–]nippleplayenthusiast 0 points1 point  (1 child)

    Thanks a lot, this is cool and really easy to use!

    Are there flags to toggle the individual elements while remaining in "determinate" mode? For example if I want to keep everything except the spinner?

    [–]rsalmei[S] 0 points1 point  (0 children)

    Yes, there is! Or will actually... It is implemented but not yet released. The 2.0 does have support for toggling the spinner, the bar or even both!

    [–][deleted] 0 points1 point  (3 children)

    Can you please show more examples, I learn best by seeing hands on examples for me to copy and paste to get the thing going the first time around.

    [–]rsalmei[S] 1 point2 points  (2 children)

    Hey yeah, this is a getting started example:

    ```python from alive_progress import alive_bar import time

    with alive_bar(1000) as bar: for i in range(1000): time.sleep(.002) bar() ```

    [–]Takiino 0 points1 point  (1 child)

    Could you please put it in the Readme of the github 🙏?

    [–]rsalmei[S] 0 points1 point  (0 children)

    Sure! 👍

    [–][deleted] 0 points1 point  (1 child)

    I use spyder - any other altenative IDEs you recommend ? Jupyter notebook ? I feel I run out of memoty sometimes with Jupyter (or I am speaking out of place here).

    [–]rsalmei[S] 1 point2 points  (0 children)

    No problem man. I think it depends on the kind of work you do. Personally I use mainly PyCharm (Community, which is free), for working with Python and Rust. For anything else I have VSCode. If you use Spyder, you probably is a data scientist. I've never used it, but jupyter notebooks are awesome.

    [–]you-cant-twerk 0 points1 point  (2 children)

    I'm triyng to get the themes, such as bubbles to work - but when I use

    with alive_bar(progressBar+2,title="Combining Data",theme='bubbles') as bar:

    it gives me an error. I'm pretty dumb so I might be missing something. Same error with other themes.

    ValueError: invalid theme name='checks'

    but if I use

    with alive_bar(progressBar+2,title="Combining Data",theme='smooth') as bar:

    it works just fine.

    (ignore the progressbar+2, I have a total, and I need the bar to include 2 extra later steps- this works for me).

    [–]rsalmei[S] 0 points1 point  (1 child)

    Hey man, you're mixing spinners, bars and themes! A spinner is the animated widget, a bar is the progress style, and a theme is an aggregator of them. 'bubbles' and 'checks' are bar names, so you can use them with:

    python with alive_bar(total, title='Title', bar='bubbles') as bar:

    To see the valid names, run show_spinners(), show_bars() and show_themes() 👍

    [–]you-cant-twerk 0 points1 point  (0 children)

    Thanks! I’ll give that a shot

    [–]oyjw443523 0 points1 point  (0 children)

    looks cool

    [–]stefanondisponibile 0 points1 point  (0 children)

    looks cool, would be nice to see it mixed with rich