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

JupyterLab 3 support v2 #452

Merged
merged 78 commits into from
Jan 6, 2021
Merged
Show file tree
Hide file tree
Changes from 56 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
64ed3de
JupyterLab 3
martinRenou Nov 9, 2020
acd0163
Working version without jupyter-packaging
martinRenou Nov 13, 2020
a170681
Fix import
martinRenou Nov 13, 2020
c52ed55
Remove jupyter-packaging
martinRenou Nov 13, 2020
1a0341d
Bring back the original postBuild command
martinRenou Nov 13, 2020
43801d7
Build schemas
martinRenou Nov 13, 2020
a5a5bc6
Install pytest-tornasync from conda-forge
martinRenou Nov 13, 2020
80a9973
Remove use of chdir
martinRenou Nov 13, 2020
21c2cbc
Fix data_files
martinRenou Nov 13, 2020
df6bac2
Revert name change
martinRenou Nov 13, 2020
a1f87ac
Update docs and lab dependency in binder to rc10
karlaspuldaro Nov 20, 2020
eba0e53
Update dependencies to rc10
karlaspuldaro Nov 23, 2020
73c4ee3
Merge pull request #1 from karlaspuldaro/kspuldaro-lab3
martinRenou Nov 26, 2020
c90dac3
Merge branch 'jupyterlab3' of ssh://github.com/martinRenou/jupyterlab…
krassowski Jan 2, 2021
81753b4
Update versions/code-jumpers transition for JupyterLab 3.0
krassowski Jan 2, 2021
5d6bdce
Remove RC channels and versions
krassowski Jan 2, 2021
3b7ff1a
Remove RC suffixes
krassowski Jan 2, 2021
d60f7c2
Lint and integrity checks (note: Node 12 required by v3.0)
krassowski Jan 2, 2021
7e9de94
Release lumino widgets pin which was causing build error
krassowski Jan 2, 2021
ec3bfb0
Update dependencies
krassowski Jan 2, 2021
fab7e59
Restore lumino widgets pin
krassowski Jan 2, 2021
f4c286c
Set promise type to void
krassowski Jan 2, 2021
3b61f8c
Update typescript
krassowski Jan 2, 2021
b7b9016
Temporarily disable karma tests
krassowski Jan 2, 2021
fdca601
Use ServerApp.jpserver_extensions
krassowski Jan 2, 2021
0d9455b
Fix warning: manifest_maker: MANIFEST.in, line 3: 'recursive-include'…
krassowski Jan 2, 2021
0eb1927
Migrate to jupyter_server
krassowski Jan 2, 2021
e413a27
Lint and mypy adaptations for jupyter_server
krassowski Jan 2, 2021
bc1cc05
One final notebook → jupyter_server
krassowski Jan 2, 2021
c18ee69
Update CONTRIBUTING.md
krassowski Jan 2, 2021
bbd36ff
Restore jump in build
krassowski Jan 2, 2021
ed651b6
Ling bump versions
krassowski Jan 2, 2021
0edeecf
Update test workflow
krassowski Jan 2, 2021
cd15e3e
Use labextension for now
krassowski Jan 2, 2021
760f966
More jupyter_notebook_config.json → jupyter_server_config.json
krassowski Jan 2, 2021
544c314
Adapt robot for JupyterLab 3.0
krassowski Jan 2, 2021
aacbdb6
Fix syntax highlighting (needs import of cm/mode/meta)
krassowski Jan 2, 2021
b54b3fc
Update themes commands
krassowski Jan 3, 2021
43b0271
Workaround visibility issue (TypeError: rect is undefined)
krassowski Jan 3, 2021
bf9f424
Add install.json file with uninstall instructions
krassowski Jan 3, 2021
23d3df5
Update eslint dev-dependencies
krassowski Jan 3, 2021
5c329ca
Make code jumpers accept minor version bumps
krassowski Jan 3, 2021
e7c46de
Bump versions and fix jest eslint errors
krassowski Jan 3, 2021
a24a475
Pass string for install.json, not path
krassowski Jan 3, 2021
5e6af22
Update and simplify readme
krassowski Jan 3, 2021
688e682
Try to check what's wrong with the docs
krassowski Jan 3, 2021
dd59718
Revert docs conf.py modifications (output was being printed out all a…
krassowski Jan 3, 2021
f350a08
Pin node 12 for RTD
krassowski Jan 3, 2021
de5c618
Update installation documentation
krassowski Jan 3, 2021
02cd810
Fix integrity check
krassowski Jan 3, 2021
842570c
Add missing new line
krassowski Jan 3, 2021
3c736b5
Split into jupyter_lsp and jupyterlab_lsp
krassowski Jan 3, 2021
6982c48
Remove more py_src
krassowski Jan 3, 2021
000f3a2
Update package location for docs
krassowski Jan 3, 2021
976ba86
Fix typo, rename install in readme
krassowski Jan 3, 2021
63e31a9
Fix lint
krassowski Jan 3, 2021
c89e0e7
Improve separation of packages
krassowski Jan 3, 2021
0f9b7a0
Add LICENCE files
krassowski Jan 3, 2021
4c8d0bd
Be explicit about package names
krassowski Jan 3, 2021
1193fa3
Fix more typos
krassowski Jan 3, 2021
1f5d4de
This is the price we would have to pay for keeping the shorter hierarchy
krassowski Jan 3, 2021
ce76fab
Give up on using src as package root
krassowski Jan 4, 2021
cbbefe7
Remove one more old path
krassowski Jan 4, 2021
e9bf79a
Correct manifest
krassowski Jan 4, 2021
191e631
Lint
krassowski Jan 4, 2021
816bbdb
Ignore "import not on top of file" in nblint
krassowski Jan 4, 2021
fb6eeed
Lint temporary readme jupyterlab_lsp
krassowski Jan 4, 2021
f59f598
[squash] Jupyterlab3 CI updates (#454)
bollwyvl Jan 4, 2021
9a8969e
Prepare for jupyterlab_lsp rc0 (#455)
krassowski Jan 5, 2021
dea4132
Set jupyter_lsp to rc0
krassowski Jan 5, 2021
664c973
Update issue templates
krassowski Jan 5, 2021
495bc5c
Update CONTRIBUTING.md: add jupyter develop for symlinking,
krassowski Jan 5, 2021
cdee4d1
Restore and check setup.cfg integrity
krassowski Jan 6, 2021
4749fbe
Remove rc tags
krassowski Jan 6, 2021
7ab97db
Release suffix can be empty
krassowski Jan 6, 2021
228bdd0
Add pip check
krassowski Jan 6, 2021
a0baf84
add pip-only smoke test of installing artifacts
bollwyvl Jan 6, 2021
5f259fe
Merge pull request #456 from bollwyvl/add-pure-python-install-test
krassowski Jan 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/language_server_byo.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ https://jupyterlab.readthedocs.io/en/latest/getting_started/issue.html
- Language Server Spec

```python
# jupyter_notebook_config.json
# jupyter_server_config.json
{
"LanguageServerManager": {
"language_servers": {
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/job.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
os: [ubuntu-16.04]
python: [3.8]
nodejs: ['>=12,<13.0.0a0']
lab: ['>=2,<3.0.0a0']
lab: ['>=3.0.0,<4.0.0a0']
steps:
- uses: actions/checkout@v2

Expand Down
45 changes: 18 additions & 27 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ defaults:

env:
# TODO extract these from files instead
PY_JLSP_VERSION: 0.9.3
JS_JLLSP_VERSION: 2.1.2
PY_JLSP_VERSION: 1.0.0
JS_JLLSP_VERSION: 3.0.0
JS_JLG2D_VERSION: 1.0.0

PYTHONUNBUFFERED: 1
Expand All @@ -37,7 +37,7 @@ jobs:
matrix:
os: [ubuntu, macos, windows]
python: [3.6, 3.7, 3.8]
lab: ['>=2.2.0,<3.0.0a0']
lab: ['>=3.0.0,<4.0.0a0']
include:
# if using 3.6, use an old node
- python: 3.6
Expand Down Expand Up @@ -108,14 +108,23 @@ jobs:
- name: Build the extension
run: jlpm build

- name: Build python distributions
run: python setup.py sdist bdist_wheel
- name: Build server extension (jupyter_lsp) distribution
run: cd python_packages/jupyter_lsp && python setup.py sdist bdist_wheel

- name: Build npm bundles
run: jlpm lerna run bundle
- name: Install server extension (jupyter_lsp) wheel
run: cd python_packages/jupyter_lsp/dist && python -m pip install jupyter_lsp-${{ env.PY_JLSP_VERSION }}-py3-none-any.whl --no-deps

- name: Install python wheel
run: cd dist && python -m pip install jupyter_lsp-${{ env.PY_JLSP_VERSION }}-py3-none-any.whl --no-deps
- name: List server extensions
run: jupyter server extension list

- name: Build frontend extension (jupyterlab_lsp) distribution
run: cd python_packages/jupyterlab_lsp && python setup.py sdist bdist_wheel

- name: Install frontend extension (jupyterlab_lsp) wheel
run: cd python_packages/jupyterlab_lsp/dist && python -m pip install jupyterlab_lsp-${{ env.JS_JLLSP_VERSION }}-py3-none-any.whl --no-deps

- name: List frontend extensions
run: jupyter labextension list

- name: Find out jedi cache location
id: jedi-cache
Expand Down Expand Up @@ -167,27 +176,9 @@ jobs:
# summaryFileLocation: 'packages/${{ js_package }}/coverage/cobertura-coverage.xml'
# condition: always()

- name: List server extensions
run: jupyter serverextension list

- name: Run python tests
run: python scripts/utest.py

- name: Install support packages
run: jupyter labextension link --debug --no-build ${{ env.LINKED_EXTENSIONS }}

- name: Install labextensions
run: jupyter labextension install --debug --no-build packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-${{ env.JS_JLLSP_VERSION }}.tgz

- name: List labextensions before build
run: jupyter labextension list

- name: Build lab
run: jupyter lab build --debug --dev-build=False --minimize=True

- name: List labextensions after build
run: jupyter labextension list

- name: Run browser tests
run: python scripts/atest.py --exclude expect:fail

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,6 @@ coverage/
_*.d.ts
_build
.virtual_documents/

# Built labextensions
python_packages/jupyterlab_lsp/labextensions/
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
.mypy_cache
.pytest_cache
.yarn-packages
**/_*.d.ts
**/.ipynb_checkpoints
**/*.egg-info
**/build
Expand Down
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
## CHANGELOG

### `@krassowski/jupyterlab-lsp 3.0.0` (2021-01-XX)

- features

- support for JupyterLab 3.0 ([#452], [#402])

### `jupyter-lsp 1.0.0` (2021-XX-XX)

- features

- support for JupyterLab 3.0 ([#452], [#402])

[#402]: https://github.com/krassowski/jupyterlab-lsp/issues/402
[#452]: https://github.com/krassowski/jupyterlab-lsp/issues/452

### `@krassowski/jupyterlab-lsp 2.1.2` (2021-01-02)

- features
Expand Down
21 changes: 10 additions & 11 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ You can contribute to the project through:

Development requires, at a minimum:

- `nodejs >=10.12,<15`
- `nodejs >=12,<15`
- `python >=3.6,<3.9.0a0`
- Python 3.6 and 3.8 are also tested on CI
- Python 3.7 and 3.8 are also tested on CI
- Python 3.6 has issues on Windows
- `jupyterlab >=2.2.0,<3.0.0a0`
- `jupyterlab >=3.0.0,<4.0.0a0`

It is recommended to use a virtual environment (e.g. `virtualenv` or `conda env`)
for development.
Expand Down Expand Up @@ -67,7 +67,7 @@ This performs all of the basic setup steps, and is used for the binder demo.
Install `jupyter-lsp` from source in your virtual environment:

```bash
python -m pip install -e .
python -m pip install -e . --ignore-installed --no-deps -vv
```

Enable the server extension:
Expand All @@ -80,9 +80,8 @@ Install `npm` dependencies, build TypeScript packages, and link
to JupyterLab for development:

```bash
jlpm
jlpm build
jlpm lab:link
jlpm bootstrap
pip install .
```

### Frontend Development
Expand Down Expand Up @@ -328,8 +327,8 @@ server it will always win vs an auto-configured one.

> See the built-in [specs][] for implementations and some [helpers][].

[specs]: https://github.com/krassowski/jupyterlab-lsp/tree/master/py_src/jupyter_lsp/specs
[helpers]: https://github.com/krassowski/jupyterlab-lsp/blob/master/py_src/jupyter_lsp/specs/utils.py
[specs]: https://github.com/krassowski/jupyterlab-lsp/tree/master/python_packages/jupyter_lsp/src/specs
[helpers]: https://github.com/krassowski/jupyterlab-lsp/blob/master/python_packages/jupyter_lsp/src/specs/utils.py

A spec is a python function that accepts a single argument, the
`LanguageServerManager`, and returns a dictionary of the form:
Expand All @@ -349,7 +348,7 @@ the server) and `languages` (which languages to respond to), but many number of
other options to enrich the user experience are available in the
[schema][] and are exercised by the current `entry_points`-based [specs][].

[schema]: https://github.com/krassowski/jupyterlab-lsp/blob/master/py_src/jupyter_lsp/schema/schema.json
[schema]: https://github.com/krassowski/jupyterlab-lsp/blob/master/python_packages/jupyter_lsp/src/schema/schema.json

The spec should only be advertised if the command _could actually_ be run:

Expand All @@ -368,7 +367,7 @@ The spec should only be advertised if the command _could actually_ be run:
- use a helper script to encapsulate some complexity.
- See the [r spec][] for an example

[r spec]: https://github.com/krassowski/jupyterlab-lsp/blob/master/py_src/jupyter_lsp/specs/r_languageserver.py
[r spec]: https://github.com/krassowski/jupyterlab-lsp/blob/master/python_packages/jupyter_lsp/src/specs/r_languageserver.py

##### Example: making a pip-installable `cool-language-server` spec

Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in

This file was deleted.

56 changes: 11 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ Use context menu on rows in the panel to filter out diagnostics or copy their me

You will need to have all of the following installed:

- JupyterLab >=2.2.0,<3.0.0a0
- JupyterLab >=3.0.0,<4.0.0a0
- Python 3.6+
- nodejs 10.12+

In addition, if you wish to use javascript, html, markdown or any other NodeJS-based language server you will need to have appropriate NodeJS version installed.

> Note: Installation for JupyterLab 2.x requires a different procedure, please consult the documentation for the extension [version 2.x][version 2.x docs].

## Installation

Expand All @@ -94,36 +97,19 @@ Use of a python `virtualenv` or a conda env is also recommended.
conda install -c conda-forge python=3
```

1. install JupyterLab and the server extension
1. install JupyterLab and the extensions

```bash
conda install -c conda-forge 'jupyterlab>=2.2,<3.0.0a0' jupyter-lsp
conda install -c conda-forge 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
# or
pip install 'jupyterlab>=2.2,<3.0.0a0' jupyter-lsp
pip install 'jupyterlab>=3.0.0,<4.0.0a0' jupyterlab-lsp
```

> Note: `jupyterlab-lsp` provides both the server extension and the lab extension.

> Note: With conda, you could take advantage of the bundles: `jupyter-lsp-python`
> or `jupyter-lsp-r` to install both the server extension and the language server.

1. install `nodejs`

```bash
conda install -c conda-forge nodejs
# or one of the following, as an administrator
choco install nodejs # Windows with Chocolatey
sudo apt-get install nodejs # Debian/Ubuntu
sudo brew install nodejs # MacOS with Homebrew
sudo dnf install nodejs # Fedora
sudo yum install nodejs # RHEL/CentOS
```

1. install the frontend extension:

```bash
jupyter labextension install @krassowski/jupyterlab-lsp # for JupyterLab 2.x
# jupyter labextension install @krassowski/[email protected] # for JupyterLab 1.x
```

1. install LSP servers for languages of your choice; for example, for Python
([pyls](https://github.com/palantir/python-language-server)) and
R ([languageserver](https://github.com/REditorSupport/languageserver)) servers:
Expand Down Expand Up @@ -165,27 +151,6 @@ Use of a python `virtualenv` or a conda env is also recommended.
(written for a related jupyterlab-go-to-definition extension) is available
[here](https://github.com/krassowski/jupyterlab-go-to-definition/blob/master/README.md#which-directories-to-symlink).

### Updating

To update previously installed extensions:

```bash
conda update jupyter-lsp
jupyter labextension update @krassowski/jupyterlab-lsp
# or
pip install -U jupyter-lsp
jupyter labextension update @krassowski/jupyterlab-lsp
```

### Getting the latest alpha/beta/RC version

Use `install` command (update does not seem to work) appending `@<0.x.y.rc-z>` to the
extension name, like this:

```bash
jupyter labextension install @krassowski/[email protected]
```

### Configuring the servers

Server configurations can be edited using the Advanced Settings editor in JupyterLab (_Settings > Advanced Settings Editor_). For settings specific to each server, please see the [table of language servers][language-servers]. Example settings might include:
Expand Down Expand Up @@ -265,3 +230,4 @@ This would not be possible without the fantastic initial work at

[language-servers]: https://jupyterlab-lsp.readthedocs.io/en/latest/Language%20Servers.html
[installation-documentation]: https://jupyterlab-lsp.readthedocs.io/en/latest/Installation.html
[version 2.x docs]: https://jupyterlab-lsp.readthedocs.io/en/2.x/Installation.html
4 changes: 2 additions & 2 deletions atest/05_Features/Completion.robot
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ VSCode Theme Works

VSCode Dark Theme Works
${file} = Set Variable Completion.ipynb
Lab Command Use JupyterLab Dark Theme
Lab Command Use Theme: JupyterLab Dark
Wait For Splash
Capture Page Screenshot 00-theme-changed.png
Configure JupyterLab Plugin {"theme": "vscode"} plugin id=${COMPLETION PLUGIN ID}
Expand All @@ -166,7 +166,7 @@ VSCode Dark Theme Works
Capture Page Screenshot 02-completions-shown.png
Completer Should Suggest TabError
Completer Should Include Icon lsp:vscode-class-dark
Lab Command Use JupyterLab Light Theme
Lab Command Use Theme: JupyterLab Light
Wait For Splash

Works Without A Theme
Expand Down
7 changes: 7 additions & 0 deletions atest/05_Features/Hover.robot
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ Last Occurrence
Trigger Via Hover With Modifier
[Arguments] ${sel}
# bring the cursor to the element
Wokraround Visibility Problem ${sel}
Mouse Over ${sel}
# move it back and forth (wiggle) while hodling the ctrl modifier
Mouse Over With Control ${sel} x_wiggle=5
Expand All @@ -62,6 +63,7 @@ Trigger Via Hover With Modifier
Trigger Via Modifier Key Press
[Arguments] ${sel}
# bring the cursor to the element
Wokraround Visibility Problem ${sel}
Mouse Over ${sel}
Wait Until Page Contains Element ${HOVER_SIGNAL} timeout=10s
Mouse Over And Wiggle ${sel} 5
Expand All @@ -76,3 +78,8 @@ Trigger Tooltip

Setup Hover Test
Setup Notebook Python Hover.ipynb

Wokraround Visibility Problem
[Arguments] ${sel}
${width} ${height} = Get Element Size ${sel}
Run Keyword If ${width} == 0 Cover Element ${sel} # don't know why but otherwise it raises Message: TypeError: rect is undefined
2 changes: 1 addition & 1 deletion atest/06_Style.robot
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Screenshot Editor Themes with Lab Theme
Set Screenshot Directory ${SCREENSHOTS DIR}${/}style${/}${norm lab theme}
Copy File examples${/}${file} ${NOTEBOOK DIR}${/}${file}
Run Keyword If "${THEME NAMES}" == "" Wait Until Keyword Succeeds 3x 1s Get Theme Names
Lab Command Use ${lab theme} Theme
Lab Command Use Theme: ${lab theme}
Try to Close All Tabs
Setup Notebook python ${notebook} isolated=${False}
Open ${file} in ${MENU EDITOR}
Expand Down
5 changes: 4 additions & 1 deletion atest/Keywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ Initialize User Settings
Create File
... ${SETTINGS DIR}${/}@jupyterlab${/}codemirror-extension${/}commands.jupyterlab-settings
... {"styleActiveLine": true}
Create File
... ${SETTINGS DIR}${/}@jupyterlab${/}apputils-extension${/}palette.jupyterlab-settings
... {"modal": false}

Reset Plugin Settings
[Arguments] ${package}=jupyterlab-lsp ${plugin}=plugin
Expand Down Expand Up @@ -200,7 +203,7 @@ Open Context Menu for File
[Arguments] ${file}
Ensure File Browser is Open
Click Element ${JLAB CSS REFRESH FILES}
${selector} = Set Variable xpath://span[@class='jp-DirListing-itemText']\[text() = '${file}']
${selector} = Set Variable xpath://span[@class='jp-DirListing-itemText']/span\[text() = '${file}']
Wait Until Page Contains Element ${selector} timeout=10s
Open Context Menu ${selector}

Expand Down
2 changes: 1 addition & 1 deletion atest/Variables.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*** Variables ***
${FIXTURES} ${CURDIR}${/}fixtures
${NBSERVER CONF} jupyter_notebook_config.json
${NBSERVER CONF} jupyter_server_config.json
${SPLASH} id:jupyterlab-splash
# to help catch hard-coded paths and encoding issues
${BASE URL} /@est/
Expand Down
2 changes: 1 addition & 1 deletion atest/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def update_jupyter_config(path, has_traits, **key_values):
"""update an existing jupyter_notebook_config.json"""
"""update an existing jupyter_server_config.json"""
p = Path(path)
conf = json.loads(p.read_text(**ENC))

Expand Down
6 changes: 3 additions & 3 deletions binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ channels:
dependencies:
# runtime dependencies
- python >=3.6,<3.9.0a0
- jupyterlab >=2.2.0,<3.0.0a0
- notebook >=4.3.1
- jupyterlab >=3.0.0,<4.0.0a0
- jupyter_server >=1.1.2
# build dependencies
- nodejs >=10.12,<15
- nodejs >=12,<15
# for python language server (and development)
- flake8 >=3.5
- pip
Expand Down
Loading