jupyterlab-vim icon indicating copy to clipboard operation
jupyterlab-vim copied to clipboard

Extension migration for JupyterLab 2.x

Open axelfahy opened this issue 5 years ago • 13 comments

Modifications have been done according to the migration guide: https://jupyterlab.readthedocs.io/en/stable/developer/extension_migration.html

  • Update dependencies

  • Change @phosphor/* to @lumino/*

  • Change ReadonlyJSONObject to ReadonlyPartialJSONObject

  • Session is now accessible from NotebookPanel.sessionContext instead of NotebookPanel.session

  • Change required version in README

This should close #113

Please finish the following when submitting a pull request:

  • [x] Add a line to History.md briefly documenting the change.

If this is a release, additionally do the following:

  • [x] Bump the package version in package.json
  • [x] Update the dependencies in package.json
  • [x] Run jlpm install to update yarn.lock

Thanks!

axelfahy avatar Mar 06 '20 10:03 axelfahy

Already used your code. Thanks!

walkerqt avatar Mar 07 '20 14:03 walkerqt

Your welcome, while this or another solution gets merged, I have published the npm package as @axlair/jupyterlab_vim as a temporary solution.

axelfahy avatar Mar 07 '20 15:03 axelfahy

Thanks so much for making these updates! I've just installed the extension you published to temporarily replace jupyterlab_vim but for some reason it doesn't seem to be taking effect. I've rebuilt Jupyter both via the web interface and at the command line and it still gives me the default keybindings, even though your extension is shown as installed and working, in both the web and command line interface. E.g.

$ jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: /home/zane/miniconda3/envs/pudl-dev/share/jupyter/lab
        @axlair/jupyterlab_vim v0.12.1  enabled  OK
        nbdime-jupyterlab v1.0.0 disabled  X

   The following extension are outdated:
        nbdime-jupyterlab

Seems odd. Is there anything else that needs to be done to make the extension active?

zaneselvans avatar Mar 07 '20 19:03 zaneselvans

I don't think there is anything else to do to activate the extension. Maybe one of your browser's extension is conflicting with the plugin. I am using Firefox and I don't have any issue, however on Chromium, if I have the plugin Vimum activated on the page, the jupyterlab_vim plugin is not working.

axelfahy avatar Mar 09 '20 08:03 axelfahy

@zaneselvans I had a similar issue. resolved it by clearing out my virtual env entirely and rebuilding from scratch

kevlubkcm avatar Mar 09 '20 15:03 kevlubkcm

Hi, I am not too familiar with npm, but i did the following and it doesn't seem to be working:


(jupyterlab) D:\Projects>npm i @axlair/jupyterlab_vim
npm WARN saveError ENOENT: no such file or directory, open 'D:\Projects\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\Projects\package.json'
npm WARN Projects No description
npm WARN Projects No repository field.
npm WARN Projects No README data
npm WARN Projects No license field.

+ @axlair/[email protected]
updated 1 package and audited 236788 packages in 1.604s

15 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


(jupyterlab) D:\Projects>jupyter labextension list
JupyterLab v2.0.1
Known labextensions:
   app dir: D:\Anaconda3\envs\jupyterlab\share\jupyter\lab
        @jupyter-widgets/jupyterlab-manager v2.0.0 enabled  ok
        @jupyterlab/debugger v0.2.0 enabled  ok
        @jupyterlab/github v2.0.0 enabled  ok
        @jupyterlab/shortcutui v0.5.0-beta.2 enabled  ok
        @jupyterlab/toc v3.0.0 enabled  ok
        @lckr/jupyterlab_variableinspector v0.5.0 enabled  ok
        qgrid2 v1.1.2 enabled  ok

What am I doing wrong? TIA

Solution:

Got it to work. Cloned your repository and did:

jupyter labextension install .

Thanks for this work

jmrichardson avatar Mar 28 '20 22:03 jmrichardson

I'm really looking forward to use the vim plugin in Jupyter Lab 2.0. :)

Sh4pe avatar Apr 22 '20 07:04 Sh4pe

Your welcome, while this or another solution gets merged, I have published the npm package as @axlair/jupyterlab_vim as a temporary solution.

Hello! =:) Thank you for this, firstly.

I'm getting the following exception. Am I applying this incorrectly, or it's correct but my versions are not supported?

root# /opt/tljh/user/bin/jupyter labextension install jupyterlab_vim
An error occured.
ValueError: The extension "jupyterlab_vim" does not yet support the current
version of JupyterLab.


Conflicting Dependencies:
JupyterLab              Extension      Package
>=2.1.0 <2.2.0          >=1.0.1 <2.0.0 @jupyterlab/application
>=2.1.0 <2.2.0          >=1.0.1 <2.0.0 @jupyterlab/notebook
See the log file for details:  /root/.temp.d/jupyterlab-debug-esw3phkv.log

Thank you!

nmvega avatar Apr 24 '20 03:04 nmvega

What is your jupyterlab version? Have you tried in a new environment with a fresh installation of jupyterlab?

axelfahy avatar Apr 24 '20 06:04 axelfahy

@axelfahy Hi. Yes its a fresh install of TLJH, as of last night (EDT). In fact, I always build it as code from a Dockerfile for build consistency and quality, which includes steps for pip(1) updating packages in both the HUB and USER virtual environments of TLJH. So JupyterLabs version is v2.1.x. I have to check the actual version because, ironically, v2.1.1 was released 7-hours ago and I'm unsure if I rebuilt it slightly before that was released. But it's v2.1.x, for sure.

nmvega avatar Apr 24 '20 14:04 nmvega

Hi @nmvega,

Did you execute this command to install @axelfahy 's build? jupyter labextension install @axlair/jupyterlab_vim

I think executing: jupyter labextension install jupyterlab_vim will install the current master build of the jupyterlab_vim labextension, which does not support JupyterLab 2.X until this PR is merged.

TheGhostHuCodes avatar Apr 24 '20 14:04 TheGhostHuCodes

@TheGhostHuCodes Hello! I did not try that variation. I'm unfamiliar with the @ syntax unfortunately (which I guess means pull from the specified npm repository?), but I will try your suggestion in an hour or so and report back. :blush:

nmvega avatar Apr 24 '20 15:04 nmvega

@TheGhostHuCodes Hello! I did not try that variation. I'm unfamiliar with the @ syntax unfortunately (which I guess means pull from the specified npm repository?), but I will try your suggestion in an hour or so and report back.

@TheGhostHuCodes @axelfahy Hello! The variation that @TheGhostHuCodes proposed worked, just now. \o/

So for the those visiting here, the complete solution is:

root# /opt/tljh/user/bin/pip install --upgrade jupyterlab  # Upgraded from v2.1.0 to v2.1.1

root# /opt/tljh/user/bin/jupyter labextension install @axlair/jupyterlab_vim
Building jupyterlab assets (build:prod:minimize)
root#

I then reloaded my JupyterLab and Notebook sessions, and now vim(1) key-bindings work.

Notice that I did this under the USER environment of TLJH; however the above will likely work for you in any JupyterLab setting (like running it on your laptop).

@axelfahy Thank for you this solution. I've been using vi(1)/vim(1) since the days when I was stuck in many cold datacenters with only a vt100 terminal and a Sun / Solaris UNIX CLI prompt. I simply can't use arrow keys for navigation anymore. =:)

nmvega avatar Apr 24 '20 16:04 nmvega