Skip to content
This repository has been archived by the owner on Jan 26, 2022. It is now read-only.

Update to JupyterLab 2.0 #337

Merged
merged 1 commit into from Jan 15, 2020
Merged

Update to JupyterLab 2.0 #337

merged 1 commit into from Jan 15, 2020

Conversation

jtpio
Copy link
Member

@jtpio jtpio commented Jan 13, 2020

Fixes #336.
Fixes #208.

Summary of the changes

Here is a list of all the changes, so this PR can also serve as reference when updating other third-party extensions to JupyterLab 2.0

  • Update README.md to install JupyterLab 2.0 beta
  • Switch to Lumino: Switch to Lumino #208:
    • This is mostly a search / replace across the code base.
    • It is also useful to remove the existing yarn.lock file and node_modules folder.
  • Rename iconClassName to iconClass
  • Access toolbar from the console MainAreaWidget to avoid special case for the ConsolePanel.
  • Fix tests config to handle svg
  • Handle breaking changes from the kernel refactoring
  • Update other dependency version numbers to match JupyterLab

@jtpio jtpio added this to the 0.2.0 milestone Jan 13, 2020
@jtpio jtpio force-pushed the jlab-2 branch 2 times, most recently from 95739cb to 7b80d2c Compare January 13, 2020 14:01
@jtpio
Copy link
Member Author

jtpio commented Jan 13, 2020

Getting there :)

image

@jtpio jtpio force-pushed the jlab-2 branch 2 times, most recently from 3f2f49a to d4a9b5a Compare January 13, 2020 15:16
@jtpio
Copy link
Member Author

jtpio commented Jan 13, 2020

This also requires adding the jest-raw-loader as the transform for svg files.

See jupyterlab/jupyterlab@acd909b#diff-e0a6c733b0412c3c723f4e521c837291 for more info

src/index.ts Outdated
@@ -137,7 +120,7 @@ class DebuggerHandler<
shell: JupyterFrontEnd.IShell,
debug: IDebugger,
widget: W,
client: IClientSession | Session.ISession
client: Session.ISessionConnection
Copy link
Member

Choose a reason for hiding this comment

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

This is so much nicer ❤️

Thanks @jasongrout!

@@ -109,8 +109,7 @@
width: 35px;
}

.jp-ToggleSwitch::before {
content: '';
.jp-Toolbar-item .jp-ToggleSwitch svg {
Copy link
Member Author

Choose a reason for hiding this comment

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

There is now a default svg added to the dom when creating a new ToolbarButton:

image

We might want to investigate using the new JLIcon at some point instead of manipulating the element CSS directly.

Copy link
Member

Choose a reason for hiding this comment

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

Agreed.

@jtpio jtpio force-pushed the jlab-2 branch 2 times, most recently from c3326c4 to fa5b570 Compare January 13, 2020 18:30
src/session.ts Outdated Show resolved Hide resolved
@jtpio
Copy link
Member Author

jtpio commented Jan 13, 2020

Tests pass locally but are failing on CI. Investigating.

@jtpio
Copy link
Member Author

jtpio commented Jan 14, 2020

Updated the summary of the changes in the first comment, so this can serve as reference for other extensions and also help checking the JupyterLab changelog for 2.0.

@jtpio jtpio force-pushed the jlab-2 branch 3 times, most recently from 716dc14 to e02ab04 Compare January 14, 2020 11:36
@jtpio
Copy link
Member Author

jtpio commented Jan 14, 2020

There is now a warning logged to the dev tools console:

image

This is probably a side-effect of the bump to React 16.9 in jupyterlab/jupyterlab#7661, and seems to originate from react-inspector (that defines the TreeView component).

We might want to give a second try at upgrading react-inspector to the latest version (4.0.0) in a separate change.

@jtpio jtpio force-pushed the jlab-2 branch 2 times, most recently from 7bdf673 to cdd2e49 Compare January 15, 2020 10:25
@jtpio jtpio marked this pull request as ready for review January 15, 2020 10:35
@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

Marking this one as ready for review.

Two things to investigate after as follow-ups:

  • Switching to and from a "No Kernel" state seems to be broken, and requires changing the current active shell widget to trigger the update. We should handle the kernelChanged signal at the session context level for the notebook and console panels (instead of session connection level).
  • Check whether there is a better way to handler kernel restarts (Better way to handle kernel restarts #322)

We can take a look at these two points separately to keep the current PR focused on migrating to JupyterLab 2.0 only.

cc @afshin

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

@afshin let's do a 0.1.2 release before merging this one?

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

Tests seem to be flakier than before. But this might as well be an issue with the tests and the kernel readiness not being awaited correctly.

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

Adding a missing await sessionContext.session.kernel.info like in https://github.com/jupyterlab/jupyterlab/blob/master/tests/test-apputils/src/toolbar.spec.ts#L321 should do the trick.

@afshin
Copy link
Member

afshin commented Jan 15, 2020

A clean build is failing for me, have you seen this?

git clean -fdx
pip uninstall jupyterlab
pip install --upgrade --pre jupyterlab
jlpm install
jlpm build
jupyter labextension uninstall @jupyterlab/debugger
jupyter labextension install .
juoyter lab

Screen Shot 2020-01-15 at 3 37 39 PM

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

To do the upgrade, I created a new conda environment locally from scratch but haven't seen this.

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

And also:

rm -rf node_modules/
rm yarn.lock

But that should be covered by the git clean command.

@afshin
Copy link
Member

afshin commented Jan 15, 2020

The git clean -fdx removes those files. I will try in a new conda environment to check again.

@afshin
Copy link
Member

afshin commented Jan 15, 2020

It works in a brand new conda environment. I wonder what my issue is.

@jtpio
Copy link
Member Author

jtpio commented Jan 15, 2020

Good question.

We could try to reproduce a "manual upgrade" if that is worth the effort.

@afshin
Copy link
Member

afshin commented Jan 15, 2020

The issue came from ipywidgets. The old version of @jupyter-widgets/jupyterlab-manager was still installed and the JupyterLab 2 beta accepted it but failed at run-time. I think this issue was fixed in a recent PR Steve did, but I'm not 100% sure of that. (cc: @blink1073 @jasongrout)

This fixed it:
Screen Shot 2020-01-15 at 4 00 32 PM

Copy link
Member

@afshin afshin left a comment

Choose a reason for hiding this comment

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

Thank you! This looks good and works locally for me.

@afshin
Copy link
Member

afshin commented Jan 22, 2020

This PR is included in the JupyterLab 1.x to 2.x migration guide: jupyterlab/jupyterlab#7808

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to JupyterLab 2.0 Switch to Lumino
2 participants