Skip to content
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

More progress bar improvements (incl. Jupyter lab support) #1428

Merged
merged 4 commits into from
Aug 30, 2018

Conversation

jgosmann
Copy link
Collaborator

@jgosmann jgosmann commented Apr 16, 2018

Motivation and context:
Jupyter lab disables the execution of Javascript which breaks the current progress bar implementation. Version 0.32 (not released yet, but release candidates are available from PyPI) fixing an updating issue in the VDOM support that allows the implementation of the progress bar without any Javascript. VdomProgressBar takes advantage of that and works in Jupyter Lab, it might also work in future versions of Jupyter Notebook and would then allow the removal of HtmlProgressBar.

As convenience I added a VdomOrHtmlProgressBar that provides both progress bars and the Jupyter client will select the preferred version (usually VDOM if VDOM is supported). This is the new default in clients the support IPython display.

There is some sort of code duplication in VdomProgressBar and HtmlProgressBar as they effectively both construct the same DOM. We could use the VDOM from VdomProgressBar and parse it to proper HTML for the HtmlProgressBar. However, this might be wasted effort if the HtmlProgressBar might get removed in the future. While it is not super complicated todo, the CSS attribute names need to converted from camel case to hyphen notation which might be mildly annoying. But I'm open to other opinions.

Furthermore, this adds a warning that gets displayed in Jupyter Notebook versions before 5 (which are not supported).

Addresses #1426. Closes #1087.

Interactions with other PRs:
none

How has this been tested?
Manually tried in Jupyter Notebook 5.4.1 + 4.4.1, Jupyter Lab 0.32.0rc1.

How long should this take to review?

  • Average (neither quick nor lengthy)

Where should a reviewer start?
I recommend going commit by commit as they are pretty independent.

Types of changes:

  • New feature (non-breaking change which adds functionality)

Checklist:

  • I have read the CONTRIBUTING.rst document.
  • I have updated the documentation accordingly.
  • I have included a changelog entry.
  • [n/a] I have added tests to cover my changes.
  • I have run the test suite locally and all tests passed.

@Seanny123
Copy link
Contributor

I'll test this on my Windows machine, however note there's a few flake8 errors.

@Seanny123
Copy link
Contributor

Worked in both Jupyter Lab 0.32rc1 on Windows, as well as Jupyter Notebook 5.4.1. Fix the static checks and this LGTM.

@jgosmann
Copy link
Collaborator Author

Fixed the static checks and added changelog entries.

Copy link
Contributor

@Seanny123 Seanny123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Feel free to merge once the tests pass.

@Seanny123
Copy link
Contributor

FYI, this also worked on Jupyter Lab 0.32 on Ubuntu 17.10

@jgosmann
Copy link
Collaborator Author

fyi: This progress bar not only works in a notebook opened in Jupyter Lab, but also in a console opened in Jupyter Lab! 😃

@Seanny123
Copy link
Contributor

I've been using this branch for more than a month now. It works on Ubuntu 18.04 too! Consequently, I strongly recommend this for merging.

Copy link
Member

@tbekolay tbekolay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; I'll fix the typo in the merge if you can let me know that it is indeed a typo @jgosmann.

class VdomOrHtmlProgressBar(ProgressBar):
"""Progress bar using the VDOM or HTML progress bar.

This progress bar will transmit both representations as port of a MIME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to make sure, port should be part right?

@jgosmann
Copy link
Collaborator Author

jgosmann commented Aug 30, 2018 via email

@tbekolay
Copy link
Member

Great thanks!

@tbekolay tbekolay merged commit a3162b0 into master Aug 30, 2018
@tbekolay tbekolay deleted the jlab-progress branch August 30, 2018 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Rethinking the Jupyter progress bar.
3 participants