tqdm ProgressBar implementation#2617
tqdm ProgressBar implementation#2617orbeckst merged 20 commits intoMDAnalysis:developfrom cbouy:develop
Conversation
If run from a jupyter notebook or jupyter lab, will use the tqdm.notebook.tqdm class, else (ipython, shell, or anything else) will use the default tqdm.tqdm class.
|
Now it should be able to automatically detect Jupyter (notebook or lab) versus the rest and use the appropriate |
Codecov Report
@@ Coverage Diff @@
## develop #2617 +/- ##
==========================================
- Coverage 90.71% 90.7% -0.02%
==========================================
Files 174 174
Lines 23549 23562 +13
Branches 3072 3073 +1
==========================================
+ Hits 21363 21372 +9
- Misses 1565 1570 +5
+ Partials 621 620 -1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## develop #2617 +/- ##
========================================
Coverage 91.00% 91.01%
========================================
Files 174 174
Lines 23550 23595 +45
Branches 3083 3082 -1
========================================
+ Hits 21431 21474 +43
- Misses 1497 1498 +1
- Partials 622 623 +1
Continue to review full report at Codecov.
|
orbeckst
left a comment
There was a problem hiding this comment.
I like your new code.
But there's more to be done: The goal of #928 is to replace ProgressMeter with your new ProgressBar everywhere and eventually get rid of our own implementation:
- Deprecate
ProgressMeterin 1.0 and schedule for removal in 2.0.- deprecation warning
- deprecation text
- Replace all uses of
ProgressMeterinside MDAnalysis with equivalent uses ofProgressBar(as much as possible). - Add test for
ProgressMeter(testing in ipython/Jupyter is probably not feasible but doing a mock forget_ipython()to show that different backends can be selected should be easy)
Fixed the empty ProgressBar appearing in notebooks and fixed its total number of iterations displayed
Fixed errors when calculating RMSD Modified the test of the progress bar in TestRMSD Cleanup of useless n_frames and enumerate
|
The Python 2.7 version of the test is failing https://travis-ci.com/github/MDAnalysis/mdanalysis/jobs/298190141, perhaps something with comparing utf-8 strings. |
jbarnoud
left a comment
There was a problem hiding this comment.
From a very quick look on my phone, the only thing I am missing is a test assessing that the deprecation warning is issued. Good work here 👍
|
@jbarnoud should I make a proper test module for the ProgressBar and ProgressMeter then ? I find it counter-intuitive to have the test for the ProgressMeter alongside the tests for the RMSD |
|
I expect a test that creates a ProgresdMeter and makes sure the deprecation warning is issued. It should probably go with the tests of the log module.The point is to make sure that users that use the progress meter on its own actually see the warning, and that displaying it does not cause an error. We had issues like that in the past, where raising an exception was itself causing an error, because of format errors in the message. On 15 Mar 2020 17:44, Cédric Bouysset <notifications@github.com> wrote:
@jbarnoud should I make a proper test module for the ProgressBar and ProgressMeter then ? I find it counter-intuitive to have the test for the ProgressMeter alongside the tests for the RMSD
—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or unsubscribe.
|
|
I don't understand the report from codecov, could someone explain what's missing ? I've added a new class, a test for this new class, I moved a test from test_rms.py to test_log.py and created a new test for the deprecation. There should be an increase in coverage or am I getting this wrong ? |
|
Codecov can be mysterious... Sorry for the long silence. Will have a look now. |
orbeckst
left a comment
There was a problem hiding this comment.
This looks really awesome. I love how much code you deleted! The tests are nice, too.
I have one blocking comment/question. Please have a look. Otherwise this is pretty much ready to go. Nice work!
The above was a bit flippant but what I wanted to say is that it's not always clear that codecov is showing us what we expect to see and although we like to see everything green in the CI, we do overrule Codecov once we are happy. |
|
@lilyminium noticed in #2631 (comment) that the API changes. It probably should not. |
|
#2631 (comment) was phrased poorly -- as far as I can tell this does not change the API, except that |
orbeckst
left a comment
There was a problem hiding this comment.
Minor CHANGELOG comment and then I will approve and merge.
|
@lilyminium @jbarnoud thanks for pointing out that this PR fixes #2504, too #2631 (comment). |
|
Thank you @orbeckst @jbarnoud @richardjgowers for your help ! And thanks @lilyminium for mentioning the other issue ! |
orbeckst
left a comment
There was a problem hiding this comment.
Awesome.
Just waiting for CI to come back green to do the squash&merge.
|
One of the macOS jobs failed right at the start. I restarted https://travis-ci.com/github/MDAnalysis/mdanalysis/jobs/300680256 – hopefully this will all look good in an hour. |
|
@cbouy very nice contribution! |
Correction for PR MDAnalysis#2256
Fixes #928
Fixes #2504
Changes made in this Pull Request:
ProgressBarclass which inherits thetqdm.auto.tqdmobject. For now, thedisablekeyword takes precedence oververbose, i.e. if both are set to True the progress bar won't show. Settingdisable=Truewill disable the progress bar as expected. Settingverbose=Falsewill disable the progress bar.ProgressMeterthrough warning and textProgressMeterwithProgressBarPR Checklist