-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
MRG, ENH: Move to tqdm #7155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MRG, ENH: Move to tqdm #7155
Conversation
|
what do you think about this idea
https://pytorch.org/docs/stable/_modules/torch/hub.html ?
pytorch solution to avoid the dep on tqdm?
… |
|
From a quick look, it appears to be "try to import tqdm, and if we can't, use our own basic implementation". The advantages I see over us vendoring
The downsides would be:
So on balance I think it's better to add to There is a third approach -- if we're going to have some fallback experience, I'd rather i.e., make our fallback version some known vendored version of |
Codecov Report
@@ Coverage Diff @@
## master #7155 +/- ##
==========================================
- Coverage 90.08% 90.08% -0.01%
==========================================
Files 454 453 -1
Lines 82610 82566 -44
Branches 13066 13060 -6
==========================================
- Hits 74422 74379 -43
+ Misses 5361 5359 -2
- Partials 2827 2828 +1 |
|
👍 for using tqdm. What is the idea of |
Yes
Usually we only bother when we find bugs |
|
|
|
I guess a fourth option would be to add |
|
@larsoner this will likely break |
|
@jasmainak the API is only changed a little bit Looks like the
|
|
okay I see and |
|
That's one of the four(ish?) options discussed above. I think the cleanest is probably to make |
I started implementing this and I actually don't like it -- it makes us put in logic for whether or not So I'd prefer to try to use the system one, and fallback to the copy in |
|
I see, since you are putting a fallback option in |
|
@larsoner are you sure that our ProgressBar was the cause of the travis hanging? |
|
I don't think that it was. I still think we get both a maintainability and a usability benefit from this PR. |
| spinner : bool | ||
| Show a spinner. Useful for long-running processes that may not | ||
| increment the progress bar very often. This provides the user with | ||
| feedback that the progress has not stalled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we loose this benefit with tqdm ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't do a spinner. It does continuous time estimates, which are better and still update continuously.
|
@larsoner does the progressbar still work in notebooks? |
Haven't tested it. I'm willing to trust |
|
in a notebook with tqdm you need to use tqdm_notebook. It does not seem to
detect for you
if you're in a notebook or not.
Honestly I have really a mixed feeling here. What fixing something that is
not broken?
I see little benefit and a 3000 lines PR will a new dependency. Having
stuff in externals
in not free either as it generates extra packaging cost for debian
maintainers that strip out
all externals packages to use deb packages.
… |
I actually started our updating ProgressBar to do some nicer things (such as have better aesthetics), found one or two bugs (spinner symbols showing up when they shouldn't; couldn't change the characters or spacing easily), and realized that
There are more red than green lines to code we maintain. The +3000 is So from my perspective:
Sure, that's understandable. I still think taking everything into account it's a lower maintenance cost for us overall. |
|
Re packaging costs, would it be a good idea to enable using (importing) the real external package if installed? Only if the package is not installed we could resort the version from externals. |
That is what's currently done in this version of this PR. I think overall this approach reduces our maintenance costs compared to what we currently have in |
drammock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a couple comments LGTM. In general I would prefer a soft dependency where missing system tqdm would just not show progress bars at all, but @larsoner said that added a bunch of ugly conditionals into MNE code so I'm fine with having a frozen version of tqdm in externals instead, as it makes the code that we actively maintain cleaner.
@larsoner alright, so this is perfect then! I didn't check this PR for whatever reason but some other externals dependency (I think it was |
|
Looks like this was fixed in 4.36 so we just need to set some minimum version: @drammock can you verify that you're on 4.35 or lower? |
|
oops. Yes, I'm on an old version of |
|
Pushed a commit to do a version check (use our |
|
I'm 👍 for merging this PR (instead of #7418). This seems to be ready so let's do it (I'm already waiting really hard for 0.20 to be released)! |
|
ok no more bugs to report to @larsoner on my side. anyone else what's to test before we merge? |
|
@drammock do you want to try the snippet above in terminal and notebook and merge if you're happy? |
|
thanks @larsoner! |
|
@larsoner you can now open a 🍺 ...
|
|
I liked reading this one !! kudos to everyone !! :) |

I think we should move to using
tqdminstead of our own internal implementation. I think it's more stable in the long run and less code for us to maintain. It also gets us nice things like time estimates for completion for free.This PR puts
tqdminexternalsand uses it for progress bars. Some sample code to test:Details
Produces on
master:And on this PR:
tqdmis very flexible in terms of how it displays, so we can tweak this aesthetically if we want.Closes #7418