Skip to content

Commit a46f3a8

Browse files
authored
Merge pull request #204 from bollwyvl/add-lab2
Support JupyterLab 2, add jupyterlab-go-to-definition to monorepo
2 parents 2fab3ec + 8645d37 commit a46f3a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+6066
-2543
lines changed

.travis.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,26 @@ cache:
66
- $HOME/.cache/yarn
77
- $HOME/.cache/pip
88

9+
env:
10+
global:
11+
- TRAVIS_NVM_VERSION=0.35.2
12+
913
matrix:
1014
include:
1115
- python: '3.5'
12-
- python: '3.6'
13-
- python: '3.7'
16+
env: TRAVIS_NODE_VERSION=10
1417
- python: '3.8'
18+
env: TRAVIS_NODE_VERSION=12
19+
- python: '3.9-dev'
20+
env: TRAVIS_NODE_VERSION=13
1521
- os: osx
22+
env: TRAVIS_NODE_VERSION=12
1623
osx_image: xcode11
1724
language: shell
1825

1926
before_install:
27+
- wget -qO- https://raw.githubusercontent.com/creationix/nvm/v${TRAVIS_NVM_VERSION}/install.sh | bash
28+
- source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
2029
- python3 -m pip install -r requirements/utest.txt
2130
- python3 -m pip freeze
2231
- python3 setup.py sdist
@@ -34,8 +43,3 @@ script:
3443
- python3 -m jupyter serverextension list
3544
- python3 -m jupyter serverextension list | grep jupyter_lsp
3645
- python3 scripts/utest.py
37-
38-
addons:
39-
apt:
40-
packages:
41-
- nodejs

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
## CHANGELOG
22

3+
### `@krassowski/jupyterlab-lsp 1.0.0` (unreleased)
4+
5+
- features
6+
7+
- supports JupyterLab 2.0
8+
9+
### `@krassowski/jupyterlab_go_to_definition 1.0.0` (unreleased)
10+
11+
- features
12+
13+
- supports JupyterLab 2.0
14+
315
### `@krassowski/jupyterlab-lsp 0.8.0` (2020-03-12)
416

517
- features

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ You can contribute to the project through:
2929

3030
Development requires:
3131

32-
- `nodejs` 8 or later
32+
- `nodejs` 10+
3333
- `python` 3.5+
34-
- `jupyterlab` 1.1
34+
- `jupyterlab` 2
3535

3636
It is recommended to use a virtual environment (e.g. `virtualenv` or `conda env`)
3737
for development.

README.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,12 @@ Open it searching for "Show diagnostics panel" in JupyterLab commands palette or
7676

7777
Either:
7878

79-
- JupyterLab >=1.1.4,<1.2
80-
- JupyterLab >=1.2.4,<1.3.0a0
79+
- JupyterLab >=2,<2.1
8180

8281
And:
8382

8483
- Python 3.5+
85-
- nodejs 8+
84+
- nodejs 10+
8685

8786
## Installation
8887

@@ -95,16 +94,14 @@ Use of a python `virtualenv` or a conda env is also recommended.
9594

9695
```bash
9796
conda install -c conda-forge python=3
98-
# or
99-
conda install -c conda-forge jupyterlab=1.2
10097
```
10198

10299
1. install JupyterLab
103100

104101
```bash
105-
conda install -c conda-forge jupyterlab=1.2
102+
conda install -c conda-forge 'jupyterlab>=2,<2.1.0a0'
106103
# or
107-
pip install jupyterlab=1.2
104+
pip install 'jupyterlab>=2,<2.1.0a0'
108105
```
109106

110107
1. install the server extension:

atest/00_Smoke.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ Lab Version
99
Root URI
1010
[Documentation] the rootUri should be set in the page config
1111
Should Not Be Empty ${PAGE CONFIG["rootUri"]}
12+
13+
Build Skipped
14+
[Documentation] Pre-flight the page config
15+
Should Be Equal ${PAGE CONFIG["buildCheck"]} ${False}
16+
Should Be Equal ${PAGE CONFIG["buildAvailable"]} ${false}

atest/01_Editor.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ Force Tags ui:editor
44
Resource Keywords.robot
55

66
*** Variables ***
7-
${MENU EDITOR} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(., "Editor")]
8-
${MENU JUMP} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Jump to definition")]
7+
${MENU EDITOR} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "Editor")]
8+
${MENU JUMP} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Jump to definition")]
99
${CM CURSOR} css:.CodeMirror-cursor
1010
${CM CURSORS} css:.CodeMirror-cursors:not([style='visibility: hidden'])
1111

atest/Keywords.robot

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ Setup Server and Browser
1818
${home} = Set Variable ${OUTPUT DIR}${/}home
1919
${root} = Normalize Path ${OUTPUT DIR}${/}..${/}..${/}..
2020
Create Directory ${home}
21-
${WORKSPACES DIR} = Set Variable ${OUTPUT DIR}${/}workspaces
21+
Create Notebok Server Config ${home}
2222
Initialize User Settings
23-
${app args} = Set Variable --no-browser --debug --NotebookApp.base_url\='${BASE}' --port\=${PORT} --NotebookApp.token\='${token}'
24-
${path args} = Set Variable --LabApp.user_settings_dir='${SETTINGS DIR.replace('\\', '\\\\')}' --LabApp.workspaces_dir\='${WORKSPACES DIR.replace('\\', '\\\\')}'
25-
${ext args} = Set Variable --LanguageServerManager.extra_node_roots\="['${root.replace('\\', '\\\\')}']"
23+
${cmd} = Create Lab Launch Command ${root}
2624
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots
27-
${server} = Start Process jupyter-lab ${app args} ${path args} ${ext args} shell=yes env:HOME=${home} cwd=${home} stdout=${OUTPUT DIR}${/}lab.log
25+
${server} = Start Process ${cmd} shell=yes env:HOME=${home} cwd=${home} stdout=${OUTPUT DIR}${/}lab.log
2826
... stderr=STDOUT
2927
Set Global Variable ${SERVER} ${server}
3028
Open JupyterLab
@@ -33,6 +31,21 @@ Setup Server and Browser
3331
Set Global Variable ${PAGE CONFIG} ${config}
3432
Set Global Variable ${LAB VERSION} ${config["appVersion"]}
3533

34+
Create Lab Launch Command
35+
[Arguments] ${root}
36+
[Documentation] Create a JupyterLab CLI shell string, escaping for traitlets
37+
${WORKSPACES DIR} = Set Variable ${OUTPUT DIR}${/}workspaces
38+
${app args} = Set Variable --no-browser --debug --NotebookApp.base_url\='${BASE}' --port\=${PORT} --NotebookApp.token\='${TOKEN}'
39+
${path args} = Set Variable --LabApp.user_settings_dir='${SETTINGS DIR.replace('\\', '\\\\')}' --LabApp.workspaces_dir\='${WORKSPACES DIR.replace('\\', '\\\\')}'
40+
${ext args} = Set Variable --LanguageServerManager.extra_node_roots\="['${root.replace('\\', '\\\\')}']"
41+
${cmd} = Set Variable jupyter-lab ${app args} ${path args} ${ext args}
42+
[Return] ${cmd}
43+
44+
Create Notebok Server Config
45+
[Arguments] ${home}
46+
[Documentation] Copies in notebook server config file to disables npm/build checks
47+
Copy File ${FIXTURES}${/}${NBSERVER CONF} ${home}${/}${NBSERVER CONF}
48+
3649
Setup Suite For Screenshots
3750
[Arguments] ${folder}
3851
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}${folder}
@@ -59,7 +72,7 @@ Open JupyterLab
5972
${firefox} = Which firefox
6073
${geckodriver} = Which geckodriver
6174
Create WebDriver Firefox executable_path=${geckodriver} firefox_binary=${firefox} service_log_path=${OUTPUT DIR}${/}geckodriver.log
62-
Wait Until Keyword Succeeds 20x 3s Go To ${URL}lab?token=${TOKEN}
75+
Wait Until Keyword Succeeds 20x 3s Go To ${URL}lab?reset&token=${TOKEN}
6376
Set Window Size 1024 768
6477
Wait For Splash
6578

@@ -141,15 +154,21 @@ Open With JupyterLab Menu
141154
END
142155

143156
Ensure File Browser is Open
144-
${sel} = Set Variable css:.p-TabBar-tab[data-id="filebrowser"]:not(.p-mod-current)
157+
${sel} = Set Variable css:.lm-TabBar-tab[data-id="filebrowser"]:not(.lm-mod-current)
145158
${els} = Get WebElements ${sel}
146159
Run Keyword If ${els.__len__()} Click Element ${sel}
147160

148-
Rename Jupyter File
149-
[Arguments] ${old} ${new}
161+
Open Context Menu for File
162+
[Arguments] ${file}
150163
Ensure File Browser is Open
151164
Click Element css:button[title="Refresh File List"]
152-
Open Context Menu //span[@class='jp-DirListing-itemText']\[text() = '${old}']
165+
${selector} = Set Variable xpath://span[@class='jp-DirListing-itemText']\[text() = '${file}']
166+
Wait Until Page Contains Element ${selector}
167+
Open Context Menu ${selector}
168+
169+
Rename Jupyter File
170+
[Arguments] ${old} ${new}
171+
Open Context Menu for File ${old}
153172
Mouse Over ${MENU RENAME}
154173
Click Element ${MENU RENAME}
155174
Press Keys None CTRL+a
@@ -164,9 +183,7 @@ Input Into Dialog
164183
Click Element ${DIALOG ACCEPT}
165184

166185
Open ${file} in ${editor}
167-
Ensure File Browser is Open
168-
Click Element css:button[title="Refresh File List"]
169-
Open Context Menu css:.jp-DirListing-item[title="${file}"]
186+
Open Context Menu for File ${file}
170187
Mouse Over ${MENU OPEN WITH}
171188
Wait Until Page Contains Element ${editor}
172189
Mouse Over ${editor}

atest/Variables.robot

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
*** Variables ***
2+
${FIXTURES} ${CURDIR}${/}fixtures
3+
${NBSERVER CONF} jupyter_notebook_config.json
24
${SPLASH} id:jupyterlab-splash
35
# to help catch hard-coded paths
46
${BASE} /@est/
57
# override with `python scripts/atest.py --variable HEADLESS:0`
68
${HEADLESS} 1
7-
${CMD PALETTE INPUT} css:#command-palette .p-CommandPalette-input
8-
${CMD PALETTE ITEM ACTIVE} css:#command-palette .p-CommandPalette-item.p-mod-active
9+
${CMD PALETTE INPUT} css:#command-palette .lm-CommandPalette-input
10+
${CMD PALETTE ITEM ACTIVE} css:#command-palette .lm-CommandPalette-item.lm-mod-active
911
${JLAB XP TOP} //div[@id='jp-top-panel']
10-
${JLAB XP MENU ITEM LABEL} //div[@class='p-Menu-itemLabel']
11-
${JLAB XP MENU LABEL} //div[@class='p-MenuBar-itemLabel']
12+
${JLAB XP MENU ITEM LABEL} //div[@class='lm-Menu-itemLabel']
13+
${JLAB XP MENU LABEL} //div[@class='lm-MenuBar-itemLabel']
1214
${JLAB CSS VERSION} css:.jp-About-version
1315
${CSS DIALOG OK} css:.jp-Dialog .jp-mod-accept
14-
${MENU OPEN WITH} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(text(), "Open With")]
16+
${MENU OPEN WITH} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(text(), "Open With")]
1517
# R is missing on purpose (may need to use .)
16-
${MENU RENAME} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(., "ename")]
18+
${MENU RENAME} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "ename")]
1719
# N is missing on purpose
18-
${MENU NOTEBOOK} xpath://div[contains(@class, 'p-Menu-itemLabel')][contains(., "otebook")]
20+
${MENU NOTEBOOK} xpath://div[contains(@class, 'lm-Menu-itemLabel')][contains(., "otebook")]
1921
${DIAGNOSTICS PANEL} id:lsp-diagnostics-panel
20-
${DIAGNOSTIC PANEL CLOSE} css:.p-DockPanel-tabBar .p-TabBar-tab[data-id="lsp-diagnostics-panel"] .p-TabBar-tabCloseIcon
22+
${DIAGNOSTIC PANEL CLOSE} css:.lm-DockPanel-tabBar .lm-TabBar-tab[data-id="lsp-diagnostics-panel"] .lm-TabBar-tabCloseIcon
2123
${DIALOG WINDOW} css:.jp-Dialog
2224
${DIALOG INPUT} css:.jp-Input-Dialog input
2325
${DIALOG ACCEPT} css:button.jp-Dialog-button.jp-mod-accept
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"LabApp": {
3+
"tornado_settings": {
4+
"page_config_data": {
5+
"buildCheck": false,
6+
"buildAvailable": false
7+
}
8+
}
9+
}
10+
}

azure-pipelines.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ variables:
1414
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn
1515

1616
PY_JLSP_VERSION: 0.8.0
17-
JS_JLLSP_VERSION: 0.8.0
17+
JS_JLLSP_VERSION: 1.0.0
18+
JS_JLG2D_VERSION: 1.0.0
1819

1920
FIRST_PARTY_LABEXTENSIONS: >-
2021
packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-$(JS_JLLSP_VERSION).tgz
2122
22-
THIRD_PARTY_LABEXTENSIONS: >-
23-
@krassowski/jupyterlab_go_to_definition
24-
2523
LINKED_EXTENSIONS: >-
2624
packages/lsp-ws-connection
25+
packages/jupyterlab-go-to-definition
2726
2827
jobs:
2928
- template: ci/job.lint.yml

0 commit comments

Comments
 (0)