Skip to content

Commit

Permalink
Merge pull request #949 from krassowski/jupyterlab-4.0
Browse files Browse the repository at this point in the history
JupyterLab 4.0 migration
  • Loading branch information
krassowski authored Aug 26, 2023
2 parents ff8b6c4 + b0e8cab commit 6d0c90f
Show file tree
Hide file tree
Showing 163 changed files with 23,615 additions and 28,527 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: 'CodeQL'

on:
push:
branches: [master]
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
branches: [main]
schedule:
- cron: '16 12 * * 4'

Expand Down
76 changes: 32 additions & 44 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: CI
on:
push:
branches:
- master
- 2.x
- main
- 3.x
- 4.x
pull_request:
branches:
- master
- 2.x
- main
- 3.x
- 4.x
workflow_dispatch:

# TODO: might need to tweak `group`
Expand All @@ -30,7 +30,7 @@ env:

ATEST_PROCESSES: 2
ATEST_RETRIES: 3
JLPM_CMD: jlpm --ignore-optional --prefer-offline --frozen-lockfile
JLPM_CMD: jlpm install

# Increase this value to reset all caches
CACHE_EPOCH: 4
Expand All @@ -43,8 +43,8 @@ jobs:
strategy:
matrix:
os: [ubuntu]
nodejs: ['>=14,<15.0.0a0']
lab: ['>=3.6.0,<4.0.0a0']
nodejs: ['>=16,<17.0.0a0']
lab: ['>=4.0.5,<5.0.0a0']
r: ['>=4']
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand All @@ -99,7 +99,7 @@ jobs:
run: jlpm build

- name: Run frontend unit tests
run: jlpm test
run: jlpm test --no-bail

- name: Lint backend
run: python scripts/lint.py
Expand All @@ -123,8 +123,8 @@ jobs:
strategy:
matrix:
os: [ubuntu]
nodejs: ['>=14,<15.0.0a0']
lab: ['>=3.6.0,<4.0.0a0']
nodejs: ['>=16,<17.0.0a0']
lab: ['>=4.0.0,<5.0.0a0']
r: ['>=4']
steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand Down Expand Up @@ -214,18 +214,18 @@ jobs:
fail-fast: false
matrix:
os: ['ubuntu', 'macos', 'windows']
python: ['3.8', '3.10']
python: ['3.8', '3.11']
include:
- python: '3.8'
# Node 16 end-of-life: April 2024
# Node 16 end-of-life: 2023-09-11
nodejs: '>=16,<17.0.0.a0'
r: '>=4'
lab: '>=3.6.0,<4'
- python: '3.10'
# Node 16 end-of-life: April 2024
nodejs: '>=16,<17.0.0.a0'
lab: '>=4,<5'
- python: '3.11'
# Node 18 end-of-life: 2025-04-30
nodejs: '>=18,<19.0.0.a0'
r: '>=4'
lab: '>=3.6.0,<4'
lab: '>=4,<5'

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -264,7 +264,7 @@ jobs:
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: actions/cache@v3
with:
path: .yarn-packages
path: '.yarn/cache'
key: |
${{ env.CACHE_EPOCH }}-yarn-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
Expand Down Expand Up @@ -298,11 +298,6 @@ jobs:
jupyter server extension list
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
- name: List notebook server extensions
run: |
jupyter serverextension list
jupyter serverextension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
- name: List frontend extensions
run: |
jupyter labextension list
Expand Down Expand Up @@ -351,23 +346,20 @@ jobs:
max-parallel: 3
matrix:
os: ['ubuntu', 'macos', 'windows']
python: ['3.8', '3.9', '3.10', 'pypy-3.8']
exclude:
- os: windows
python: pypy-3.7
python: ['3.8', '3.11', 'pypy-3.8']
include:
- python: '3.8'
dist: 'jupyter*lsp*.whl'
lab: '>=3.6,<3.7'
- python: '3.9'
lab: '>=4,<5'
- python: '3.8'
dist: 'jupyter*lsp*.tar.gz'
lab: '>=3.6,<4'
- python: '3.10'
lab: '>=4,<5'
- python: '3.11'
dist: 'jupyter*lsp*.whl'
lab: '>=3.6,<4'
lab: '>=4,<5'
- python: 'pypy-3.8'
dist: 'jupyter*lsp*.tar.gz'
lab: '>=3.6,<4'
lab: '>=4,<5'
- os: 'windows'
py_cmd: python
- os: 'macos'
Expand Down Expand Up @@ -409,13 +401,13 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu]
python: ['3.8', '3.10']
nodejs: ['14']
python: ['3.8', '3.11']
nodejs: ['18']
include:
- python: '3.8'
lab: '>=3.6,<3.7'
- python: '3.10'
lab: '>=3.6,<4'
lab: '>=4,<5'
- python: '3.11'
lab: '>=4,<5'
steps:
- name: Install Python
uses: actions/setup-python@v4
Expand All @@ -434,8 +426,6 @@ jobs:
run: python -m pip install --upgrade pip wheel setuptools
- name: Install JupyterLab
run: python -m pip install 'jupyterlab${{ matrix.lab }}'
- name: Install Notebook (to test serverextension)
run: python -m pip install 'notebook'
- name: Install the server package
run: cd dist && python -m pip install -vv jupyter_lsp*.whl
- name: install the source extension
Expand All @@ -445,7 +435,5 @@ jobs:
set -eux
jupyter labextension list
jupyter server extension list
jupyter serverextension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
jupyter serverextension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,8 @@ _build

# Built labextensions
python_packages/*/*/labextensions/

# Berry
.pnp.cjs
.pnp.loader.mjs
.yarn/
2 changes: 0 additions & 2 deletions .yarnrc

This file was deleted.

1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Changelog

### `@jupyter-lsp/jupyterlab-lsp 5.0.0-alpha.0`

- maintenance:
- support JupyterLab 4

Requires JupyterLab `>=4.0.5,<5.0.0a0`

### `@jupyter-lsp/jupyterlab-lsp 4.2.0` (2023-05-28)

- features:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Development requires, at a minimum:

- `nodejs >=16,!=17,<19`
- `python >=3.8,<3.11.0a0`
- `jupyterlab >=3.6.0,<4.0.0a0`
- `jupyterlab >=4.0.5,<5.0.0a0`

It is recommended to use a virtual environment (e.g. `virtualenv` or `conda env`)
for development.
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Language Server Protocol integration for Jupyter(Lab)

[![tests](https://github.com/jupyter-lsp/jupyterlab-lsp/workflows/CI/badge.svg)](https://github.com/jupyter-lsp/jupyterlab-lsp/actions?query=workflow%3ACI+branch%3Amaster)
[![tests](https://github.com/jupyter-lsp/jupyterlab-lsp/workflows/CI/badge.svg)](https://github.com/jupyter-lsp/jupyterlab-lsp/actions?query=workflow%3ACI+branch%3Amain)
[![Documentation Status](https://readthedocs.org/projects/jupyterlab-lsp/badge/?version=latest)](https://jupyterlab-lsp.readthedocs.io/en/latest/?badge=latest)
[![Python Demo](https://img.shields.io/badge/demo-Python-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-python/main?urlpath=lab)
[![R Demo](https://img.shields.io/badge/demo-R-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-r/main?urlpath=lab)
[![Julia Demo](https://img.shields.io/badge/demo-Julia-blue)](https://mybinder.org/v2/gh/jupyter-lsp/demo-julia/main?urlpath=lab)
[![Binder](https://img.shields.io/badge/launch-dev_version-blue)](https://mybinder.org/v2/gh/jupyter-lsp/jupyterlab-lsp/master?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)
[![Binder](https://img.shields.io/badge/launch-dev_version-blue)](https://mybinder.org/v2/gh/jupyter-lsp/jupyterlab-lsp/main?urlpath=lab%2Ftree%2Fexamples%2FPython.ipynb)

**[Installation](#installation) | [Configuring](./docs/Configuring.ipynb) | [Changelog](./CHANGELOG.md) | [Roadmap](./docs/Roadmap.ipynb) | [Contributing](./CONTRIBUTING.md) | [Extending](./docs/Extending.ipynb)**

Expand All @@ -19,20 +19,20 @@ Hover over any piece of code; if an underline appears, you can press <kbd>Ctrl</
to get a tooltip with function/class signature, module documentation or any other
piece of information that the language server provides

![hover](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/hover.png)
![hover](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/hover.png)

### Diagnostics

Critical errors have red underline, warnings are orange, etc. Hover
over the underlined code to see a more detailed message

![inspections](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/inspections.png)
![inspections](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/inspections.png)

### Jump to Definition and References

Use the context menu entry, or <kbd>Alt</kbd> + :computer_mouse: to jump to definitions/references (you can change it to <kbd>Ctrl</kbd>/<kbd>⌘</kbd> in settings); use <kbd>Alt</kbd> + <kbd>o</kbd> to jump back.

![jump](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/jump_to_definition.png)
![jump](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/jump_to_definition.png)

### Highlight References

Expand All @@ -44,19 +44,19 @@ Place your cursor on a variable, function, etc and all the usages will be highli
completion.
- You can choose to receive the completion suggestions as you type by enabling `continuousHinting` setting.

![invoke](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/autocompletion.gif)
![invoke](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/autocompletion.gif)

### Automatic Signature Suggestions

Function signatures will automatically be displayed

![signature](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/signature.png)
![signature](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/signature.png)

### Kernel-less Autocompletion

Advanced static-analysis autocompletion without a running kernel

![autocompletion](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/completions-Julia-Python-R.gif)
![autocompletion](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/completions-Julia-Python-R.gif)

#### The runtime kernel suggestions are still there

Expand All @@ -76,21 +76,21 @@ setting; Or add both if you like to code in hardcore mode and get no completions
Rename variables, functions and more, in both: notebooks and the file editor.
Use the context menu option or the <kbd>F2</kbd> shortcut to invoke.

![rename](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/rename.png)
![rename](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/rename.png)

### Diagnostics panel

Sort and jump between the diagnostics using the diagnostics panel.
Open it searching for "Show diagnostics panel" in JupyterLab commands palette or from the context menu.
Use context menu on rows in the panel to filter out diagnostics or copy their message.

![panel](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/master/examples/screenshots/panel.png)
![panel](https://raw.githubusercontent.com/jupyter-lsp/jupyterlab-lsp/main/examples/screenshots/panel.png)

## Prerequisites

You will need to have both of the following installed:

- JupyterLab >=3.6.0,<4.0.0a0
- JupyterLab >=4.0.5,<5.0.0a0
- Python 3.8+

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.
Expand All @@ -113,9 +113,9 @@ Use of a python `virtualenv` or a conda env is also recommended.
1. install JupyterLab and the extensions

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

> Note: `jupyterlab-lsp` provides both the server extension and the lab extension.
Expand Down
3 changes: 2 additions & 1 deletion atest/03_Notebook.robot
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ Test Setup Try to Close All Tabs
Python
[Setup] Setup Notebook Python Python.ipynb
${diagnostic} = Set Variable W291 trailing whitespace (pycodestyle)
Wait Until Page Contains Element css:.cm-lsp-diagnostic[title="${diagnostic}"] timeout=35s
# TODO: no title for diagnostics; we can get the title with JS via `element.cmView.mark.spec.diagnostic.message` but this is not selectable
Wait Until Page Contains Element css:.cm-lintRange[title="${diagnostic}"] timeout=35s
Capture Page Screenshot 01-python.png
[Teardown] Clean Up After Working With File Python.ipynb

Expand Down
2 changes: 1 addition & 1 deletion atest/04_Interface/Statusbar.robot
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Status Changes Between Notebooks
Setup Notebook Python Python.ipynb
Wait Until Fully Initialized
Open New Notebook
Element Should Contain ${STATUSBAR} Waiting...
Element Should Contain ${STATUSBAR} Waiting
Wait Until Fully Initialized
Switch To Tab Python.ipynb
Wait Until Fully Initialized
Expand Down
Loading

0 comments on commit 6d0c90f

Please sign in to comment.