Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@AbysmalBiscuit
Copy link
Contributor

Fix tqdm_notebook description being truncated for long descriptions.
Related to issue #582

@AbysmalBiscuit AbysmalBiscuit changed the title Fix tqdm_notebook description being truncated for long descriptions. #582 Fix tqdm_notebook description being truncated for long descriptions. Aug 29, 2018
@codecov-io
Copy link

Codecov Report

Merging #599 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master     #599   +/-   ##
=======================================
  Coverage   99.14%   99.14%           
=======================================
  Files           9        9           
  Lines         704      704           
  Branches      125      125           
=======================================
  Hits          698      698           
  Misses          3        3           
  Partials        3        3

@chengs
Copy link
Contributor

chengs commented Aug 31, 2018

Looks good to me. @casperdcl @AbysmalBiscuit
One suggestion, this description_width seems to be added recently (in ipywidgets 7.1)
So it's better to verify first that this commit does not cause any error in previous ipywidgets versions.
If so, maybe to add a version detection line.

https://ipywidgets.readthedocs.io/en/stable/changelog.html

@chengs chengs added the submodule-notebook 📓 Much web such IDE label Aug 31, 2018
@AbysmalBiscuit
Copy link
Contributor Author

AbysmalBiscuit commented Aug 31, 2018

@chengs Thanks for the suggestions!

I tested to see if the impact of ipywidgets' version. The earliest release of ipywidgets that has IntProgress is 7.0.0a7, trying to adjust the description width caused no issues for me (it just didn't do anything).
From version 7.0.0a10 adjusting the description width works.

The following are a series of srceenshots from the various relevant versions:
7.0.0a6 (no IntProgress yet):
screenshot from 2018-08-31 15-51-03

7.0.0a7 (IntProgress available but description width cannot be adjusted):
screenshot from 2018-08-31 15-51-23

7.0.0a9 (last release before description can be adjusted):
screenshot from 2018-08-31 15-51-54

7.0.0a10 (description can be adjusted):
screenshot from 2018-08-31 15-52-26

I don't know why with version 7.0.0a6 a NameError wasn't thrown in status_printer.

Based on this, should I add a version check that will throw an ImportError for anything older than 7.0.0a7 and issue a warning when someone uses a version up to 7.0.0a10 (the warning being for: 7.0.0a7 <= version <= 7.0.0a9); or should I just throw an ImportError that tells people to install at least version 7.0.0a10?

Also I have realized that I haven't yet tested older versions of ipython, so I'll test those as well.

Edit: changed back to original question.

@chengs
Copy link
Contributor

chengs commented Sep 2, 2018

WOW, nice research work!
Regarding your question, IMHO, no need to remind user (throw an error or warning) on this issue.
So it's better to check if ipywidget.version > 7.1, and only add {'description_width': 'initial'} if so.

@AbysmalBiscuit
Copy link
Contributor Author

AbysmalBiscuit commented Sep 6, 2018

Hey, so I had added a version check, and I realized a problem with it. Checking the version of ipywidgets requires that it be installed.

Hence if IntProgress was imported from IPython.html.widgets (cases where IPython is old), then the check would throw a NameError.

I had tried assigning a description update function, based on the version of ipywidgets, and if it was installed, but that didn't work unfortunately.

Also, setting the style would only throw an error if a widget has no style attribute, otherwise it would just add the css rule to the page. The css rule by itself wouldn't do anything. I had tried to setup an environment using Anaconda to test older versions of IPython, but I couldn't get the jupyter notebook to run correctly.

Edit: Should I then just add a try-except block around where I check the version?

@chengs
Copy link
Contributor

chengs commented Sep 7, 2018

@AbysmalBiscuit I think, now it is okay.
Can you verify if it works (especially in python 2)?

@chengs chengs requested a review from casperdcl September 10, 2018 00:18
@AbysmalBiscuit
Copy link
Contributor Author

@chengs sorry for the delay.

I have checked it using a Python2 kernel in Jupyter and it works fine.

@casperdcl casperdcl self-assigned this Sep 11, 2018
@casperdcl casperdcl added the to-review 🔍 Awaiting final confirmation label Sep 11, 2018
@casperdcl casperdcl added to-merge ↰ Imminent and removed to-review 🔍 Awaiting final confirmation labels Oct 14, 2018
@casperdcl
Copy link
Member

fixes #582

@casperdcl casperdcl closed this in a49478c Oct 15, 2018
casperdcl added a commit that referenced this pull request Oct 15, 2018
- fix `str.isnumeric` #605
- fix `WeakSet` `KeyError` #548, #553, #596 -> #607
- stop `tqdm_notebook` description truncation #582 -> #599
- include `unit_scale` for `rate` #608
- add `auto` -> nowarning `autonotebook`
- add better postfix numeric formatting #621
- minor refactoring #609 -> #616
- update documentation
- add unit tests
- fix py26 CI
casperdcl added a commit that referenced this pull request Oct 15, 2018
- fix `str.isnumeric` #605
- fix `WeakSet` `KeyError` #548, #553, #596 -> #607
- stop `tqdm_notebook` description truncation #582 -> #599
- include `unit_scale` for `rate` #608
- add `auto` -> nowarning `autonotebook`
- add better postfix numeric formatting #621
- minor refactoring #609 -> #616
- update documentation
- add unit tests
- fix py26 CI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

submodule-notebook 📓 Much web such IDE to-merge ↰ Imminent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants