Fix tqdm_pandas(tqdm_notebook) by delaying instanciation in tqdm_pandas#192
Fix tqdm_pandas(tqdm_notebook) by delaying instanciation in tqdm_pandas#192
Conversation
Current coverage is 79.92% (diff: 15.15%)@@ master #192 diff @@
==========================================
Files 8 8
Lines 527 538 +11
Methods 0 0
Messages 0 0
Branches 99 101 +2
==========================================
+ Hits 429 430 +1
- Misses 98 108 +10
Partials 0 0
|
|
Hmm I'd asked about doing it this way instead when creating this feature but since there didn't seem to be a clear advantage back then we stuck witht the current version... this PR is not backwards compatible, but could be fixed. |
|
Yes indeed I thought about it afterwards, we can simply detect whether the
|
c6b2252 to
2e74274
Compare
|
I added a deprecation message using |
2e74274 to
787f3b2
Compare
|
Wow that's great @casperdcl , thank's a lot! Just out of curiosity, why did you make tqdm_pandas a classmethod? What is the advantage in this case? |
|
because the way you'd re-written it in this PR was combined with the fact that an instance is created within the inner function, this means tqdm.pandas()
... # any number of `progress_apply` calls will go to terminal
tqdm_gui.pandas()
... # now use gui instead |
|
re: python warning confusions, much sad such is. was vaguely aware of this; surely there's a better solution. We could always |
|
@casperdcl Great about the classmethod, talk about the low entry high ceiling of python, I still often learn new stuff XD I thought about doing a class for the warning, but how would you raise it? If you raise it as an exception, then the old way of using tqdm_pandas will need to be specifically caught by users, so it breaks retrocompatibility. I do not know of any other way to raise a non-blocking warning in Python than just printing... |
|
But yeah it would be nice to have a standardized way of raising deprecation warnings, because I guess we will get more and more as time goes. |
|
@lrq3000 There is! Here's a doc link! ;) It's just You can raise warnings using |
|
@CrazyPython Yes but the |
|
Ok so maybe we can add something like that in Then to use: What do you think about it guys? |
Signed-off-by: Stephen L. <[email protected]>
Signed-off-by: Stephen L. <[email protected]>
f020419 to
7f6c45c
Compare
17e0bba to
a4974c7
Compare
85013f2 to
9fa8cc5
Compare
9fa8cc5 to
7f6c45c
Compare
This fixes #182 but this breaks retrocompatibility since
tqdm_pandasdoes not accept a bar instance anymore (tqdm_pandas(tqdm(leave=True))) but a bar class (tqdm_pandas(tqdm, leave=True))./EDIT: fixed backwards compatibility.