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

[wip] Add Language Server Proxy Kernel #278

Open
wants to merge 87 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
6016999
start kernel
bollwyvl May 31, 2020
c2a38e7
linting
bollwyvl May 31, 2020
5cf3b81
linting
bollwyvl May 31, 2020
7999598
replace fetchsessions
bollwyvl Jun 1, 2020
3c09ad0
add primer coat of json-rpc, lsp comms
bollwyvl Jun 4, 2020
a2129a5
hoist most of used connection interface
bollwyvl Jun 4, 2020
49406fb
round out capabilities, connect, initialize
bollwyvl Jun 4, 2020
70accbd
start removing lsp-ws-connection from lab build
bollwyvl Jun 4, 2020
2686f6b
upgrade ts, prettier: mostly working kernel-based language server ses…
bollwyvl Jun 5, 2020
74f4e51
linting, update deps
bollwyvl Jun 6, 2020
ac34763
more requirements
bollwyvl Jun 6, 2020
2c4fbc7
linting
bollwyvl Jun 6, 2020
e1e737f
linting
bollwyvl Jun 6, 2020
f5af9b5
test kernel install
bollwyvl Jun 6, 2020
a7a1ac1
fix up python unit tests
bollwyvl Jun 6, 2020
255c765
rename comm connection
bollwyvl Jun 6, 2020
6aca266
start working on updating unit tests
bollwyvl Jun 6, 2020
54de095
disable lwsp-ws tests
bollwyvl Jun 6, 2020
4024a31
more import cleanup
bollwyvl Jun 6, 2020
9ef459d
remove some more websocket details
bollwyvl Jun 6, 2020
95a9888
clean up some console junk
bollwyvl Jun 6, 2020
df25806
remove more console junk
bollwyvl Jun 6, 2020
d0a84b3
pre-defined service manager
bollwyvl Jun 6, 2020
cda85ef
restore historical notebook-based config, for now
bollwyvl Jun 6, 2020
9ed70bb
tweak coverage for config loading
bollwyvl Jun 6, 2020
5f04011
add shadow stuff to kernel, more node root
bollwyvl Jun 7, 2020
2e3d575
notify messages don't get an id
bollwyvl Jun 7, 2020
a3bad47
handle extra_node_root in atest
bollwyvl Jun 7, 2020
951b3fa
fix up shut down kernel completion test
bollwyvl Jun 7, 2020
1c88566
remove lsp-ws, bump versions
bollwyvl Jun 7, 2020
695b361
linting, remove wsbuild from bootstrap
bollwyvl Jun 7, 2020
eeeb1d2
start removing pageconfig
bollwyvl Jun 7, 2020
f1a3cc3
fix rootUri in tests
bollwyvl Jun 7, 2020
fa59ac4
start removing serverextension
bollwyvl Jun 7, 2020
4930daa
more notebook removal
bollwyvl Jun 7, 2020
ec039c0
more clean up of tests
bollwyvl Jun 7, 2020
2c1378a
fix bad logging exception
bollwyvl Jun 7, 2020
40f5fa5
get status directly from manager
bollwyvl Jun 7, 2020
c20cf76
remove checks around manager
bollwyvl Jun 7, 2020
d56f316
no cover non-implementation
bollwyvl Jun 7, 2020
de3ae95
actually test the kernelspec install cli
bollwyvl Jun 7, 2020
b5e4715
linting
bollwyvl Jun 7, 2020
c6c3bba
remove page config test for uri
bollwyvl Jun 7, 2020
26f06b1
update the arch docs
bollwyvl Jun 7, 2020
9c53820
turn down timeouts and retries to get something to finish on windows
bollwyvl Jun 8, 2020
d64273c
back off of Path traitlet for py35
bollwyvl Jun 8, 2020
9e5ad75
some more work on windows paths in robot
bollwyvl Jun 8, 2020
b426d24
path quoting for windows
bollwyvl Jun 8, 2020
638d345
try libarchive on a hunch
bollwyvl Jun 8, 2020
3572ea9
one more atest retry
bollwyvl Jun 9, 2020
c4af2cc
reuse control and language server comms
bollwyvl Jun 9, 2020
101c31b
fix up required fields in schema
bollwyvl Jun 9, 2020
f5562ff
remove optional chain from comm_ids
bollwyvl Jun 9, 2020
c47a45f
finish up dealing with comm_id
bollwyvl Jun 9, 2020
d06bb11
Merge remote-tracking branch 'origin/add-language-server-kernel' into…
bollwyvl Jun 9, 2020
ac36b41
set atest retries back to 3 (original value)
bollwyvl Jun 10, 2020
d86b92e
consolidate lsp types/constants
bollwyvl Jun 11, 2020
b1e4f20
Merge remote-tracking branch 'origin/add-language-server-kernel' into…
bollwyvl Jun 11, 2020
764ee28
move methods to namespace
bollwyvl Jun 11, 2020
17dae8e
linting
bollwyvl Jun 11, 2020
fe8a572
remove websocket from connect
bollwyvl Jun 11, 2020
8019b1a
clean up capabilities
bollwyvl Jun 11, 2020
db6f536
remove legacy emit argument for connection methods
bollwyvl Jun 11, 2020
81d98e8
request new comms when kernel dies
bollwyvl Jun 12, 2020
6752182
fix rename provider check
bollwyvl Jun 12, 2020
78bef59
merging master
bollwyvl Jun 15, 2020
7e98539
linting
bollwyvl Jun 15, 2020
ae96891
warn on cong notify error
bollwyvl Jun 15, 2020
5249d11
linting
bollwyvl Jun 15, 2020
336870e
start unifying comm targets
bollwyvl Jun 15, 2020
2626d86
fix utest
bollwyvl Jun 15, 2020
ce71f09
handle some potentially malformed messages
bollwyvl Jun 15, 2020
a1badc5
merge master
bollwyvl Jun 16, 2020
2508cc7
linting
bollwyvl Jun 16, 2020
737f961
some more cleanup on architecture diagrams
bollwyvl Jun 16, 2020
6c8899f
smore more cleanup on architecture diagrams
bollwyvl Jun 16, 2020
65542f2
disable docs in azure (now done by rtd)
bollwyvl Jun 16, 2020
2ee1f6d
some more docs about the serverextension->kernel transition
bollwyvl Jun 16, 2020
7bc7e32
update some more docs with kernel stuff
bollwyvl Jun 16, 2020
2e7bfe9
linting
bollwyvl Jun 16, 2020
03015f4
ensure docs are opened before changing
bollwyvl Jun 16, 2020
0cd699d
merge master
bollwyvl Jul 19, 2020
cb1baf6
upgrading lab
bollwyvl Jul 19, 2020
1423eaf
more headless work on notebook
bollwyvl Jul 19, 2020
98cc055
linting
bollwyvl Jul 19, 2020
c379117
move imports because lint
bollwyvl Jul 19, 2020
e5610af
use base env in test
bollwyvl Jul 19, 2020
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
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ https://jupyterlab.readthedocs.io/en/latest/getting_started/issue.html
- Browser and version:
- JupyterLab version:

<details><summary>Required: installed server extensions</summary>
<details><summary>Required: installed Kernel</summary>
<pre>
Paste the output from running `jupyter serverextension list` from the command line here.
Paste the output from running `jupyter kernelspec list` from the command line here.
You may want to sanitize the paths in the output.
</pre>
</details>
Expand Down
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ before_script:

script:
- jlpm test
- python3 -m jupyter serverextension list
- python3 -m jupyter serverextension list | grep jupyter_lsp
- python3 scripts/utest.py
- python3 -m jupyter kernelspec list
- python3 -m jupyter lsp kernelspec install
- python3 -m jupyter kernelspec list | grep jupyter-lsp-kernel
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
## CHANGELOG

### `@krassowski/jupyterlab-lsp 2.0.0` (unreleased)

- features

- replaces use of custom WebSockets and REST API with Jupyter Kernel Comms
- substantially reduced total install size (1.5mb -> ???kb)

- dependencies

- removes run-time dependencies
- `krassowski/lsp-ws-connection`
- `event-emitter`
- `vscode-language-server-protocol` and friends

### `jupyter-lsp 1.0.0` (unreleased)

- features

- replaces the former server extension with a Language Server Kernel
- adds `jupyter lsp` CLI target for
- installing the kernelspec

### `@krassowski/jupyterlab_go_to_definition 2.0.0` (unreleased)

- dependencies

- supports JupyterLab 2.0

### `@krassowski/jupyterlab-lsp 1.0.1` (unreleased)

- bug fixes
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Install `jupyter-lsp` from source in your virtual environment:
python -m pip install -e .
```

Enable the server extension:
Install the Language Server Kernel spec:

```bash
jupyter serverextension enable --sys-prefix --py jupyter_lsp
jupyter lsp kernselspec install --sys-prefix
```

Install `npm` dependencies, build TypeScript packages, and link
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ Open it searching for "Show diagnostics panel" in JupyterLab commands palette or

Either:

- JupyterLab >=2.1.0,<3.0.0a0
- JupyterLab >=2.2.0,<3.0.0a0

And:

Expand Down Expand Up @@ -104,12 +104,18 @@ Use of a python `virtualenv` or a conda env is also recommended.
pip install 'jupyterlab>=2.1,<3.0.0a0'
```

1. install the server extension:
1. install the kernel:

```bash
pip install jupyter-lsp
```

1. enable the kernelspec

```bash
jupyter lsp kernelspec install
```

1. install `nodejs`

```bash
Expand Down
4 changes: 0 additions & 4 deletions atest/00_Smoke.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ Resource Keywords.robot
Lab Version
Capture Page Screenshot 00-smoke.png

Root URI
[Documentation] the rootUri should be set in the page config
Should Not Be Empty ${PAGE CONFIG["rootUri"]}

Build Skipped
[Documentation] Pre-flight the page config
Should Be Equal ${PAGE CONFIG["buildCheck"]} ${False}
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Completion.robot
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Works With Kernel Running
Should Contain ${content} TabError

Works When Kernel Is Shut Down
Lab Command Shut Down All Kernels…
Switch Kernel No Kernel
Capture Page Screenshot 01-shutting-kernels.png
Accept Default Dialog Option
Capture Page Screenshot 02-kernels-shut.png
Expand Down
17 changes: 10 additions & 7 deletions atest/Keywords.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ Library SeleniumLibrary
Library OperatingSystem
Library Process
Library String
Library Collections
Library ./ports.py
Library ./config.py

*** Keywords ***
Setup Server and Browser
Expand All @@ -18,7 +20,7 @@ Setup Server and Browser
${home} = Set Variable ${OUTPUT DIR}${/}home
${root} = Normalize Path ${OUTPUT DIR}${/}..${/}..${/}..
Create Directory ${home}
Create Notebok Server Config ${home}
Initialize Server Config ${home} ${root}
Initialize User Settings
${cmd} = Create Lab Launch Command ${root}
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots
Expand All @@ -43,11 +45,6 @@ Create Lab Launch Command
${cmd} = Set Variable jupyter-lab ${app args} ${path args} ${ext args}
[Return] ${cmd}

Create Notebok Server Config
[Arguments] ${home}
[Documentation] Copies in notebook server config file to disables npm/build checks
Copy File ${FIXTURES}${/}${NBSERVER CONF} ${home}${/}${NBSERVER CONF}

Setup Suite For Screenshots
[Arguments] ${folder}
Set Screenshot Directory ${OUTPUT DIR}${/}screenshots${/}${folder}
Expand Down Expand Up @@ -253,14 +250,20 @@ Place Cursor In Cell Editor At
Execute JavaScript return document.querySelector('.jp-Cell:nth-child(${cell_nr}) .CodeMirror').CodeMirror.setCursor({line: ${line} - 1, ch: ${character}})

Wait Until Fully Initialized
Wait Until Element Contains ${STATUSBAR} Fully initialized timeout=60s
Wait Until Element Contains ${STATUSBAR} Fully initialized timeout=30s

Open Context Menu Over
[Arguments] ${sel}
Wait Until Keyword Succeeds 10 x 0.1 s Mouse Over ${sel}
Wait Until Keyword Succeeds 10 x 0.1 s Click Element ${sel}
Wait Until Keyword Succeeds 10 x 0.1 s Open Context Menu ${sel}

Switch Kernel
[Arguments] ${kernel name}
Click Element css:.jp-Toolbar-kernelName
Select From List By Label css:.jp-Dialog select ${kernel name}
Click Element css:.jp-mod-accept

Prepare File for Editing
[Arguments] ${Language} ${Screenshots} ${file}
Set Tags language:${Language.lower()}
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
${ROOT} ${CURDIR}${/}..
${SPLASH} id:jupyterlab-splash
# to help catch hard-coded paths
${BASE} /@est/
Expand Down
22 changes: 22 additions & 0 deletions atest/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
""" handle jupyter config
"""
import json
from pathlib import Path

NO_BUILD = {
"LabApp": {
"tornado_settings": {
"page_config_data": {"buildCheck": False, "buildAvailable": False}
}
}
}


def initialize_server_config(home, root):
""" make a notebook server config file
"""
config = dict(LanguageServerManager=dict(extra_node_roots=[root]), **NO_BUILD)

(Path(home) / "jupyter_notebook_config.json").write_text(
json.dumps(config, indent=2, sort_keys=True)
)
10 changes: 0 additions & 10 deletions atest/fixtures/jupyter_notebook_config.json

This file was deleted.

8 changes: 3 additions & 5 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,16 @@ variables:
ATEST_RETRIES: 3
YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn

PY_JLSP_VERSION: 0.8.0
JS_JLLSP_VERSION: 1.0.0
JS_JLG2D_VERSION: 1.0.0
PY_JLSP_VERSION: 1.0.0
JS_JLLSP_VERSION: 2.0.0
JS_JLG2D_VERSION: 2.0.0

FIRST_PARTY_LABEXTENSIONS: >-
packages/jupyterlab-lsp/krassowski-jupyterlab-lsp-$(JS_JLLSP_VERSION).tgz

LINKED_EXTENSIONS: >-
packages/lsp-ws-connection
packages/jupyterlab-go-to-definition

jobs:
- template: ci/job.lint.yml
- template: ci/job.test.yml
- template: ci/job.docs.yml
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:
dependencies:
# runtime dependencies
- python >=3.7,<3.8.0a0
- jupyterlab >=2.1.0,<3.0.0a0
- jupyterlab >=2.2.0,<3.0.0a0
- notebook >=4.3.1
# build dependencies
- nodejs >=10,<14
Expand Down
4 changes: 2 additions & 2 deletions binder/postBuild
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -eux
# do a dev install of the server side
python -m pip install -e . --ignore-installed --no-deps -vv
jupyter serverextension enable --sys-prefix --py jupyter_lsp
jupyter lsp kernelspec install

# should have no extensions
jupyter labextension list
Expand All @@ -11,7 +11,7 @@ jupyter labextension list
jlpm bootstrap

# link all pieces to lab (no build)
jlpm lab:link && jupyter labextension list
jlpm lab:link

# list extensions before build
jupyter labextension list
Expand Down
1 change: 1 addition & 0 deletions ci/env-test.yml.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ dependencies:
- jupyterlab {lab}
# build dependencies
- nodejs {nodejs}
- python-libarchive-c
# for python language server (and development)
- flake8 >=3.5
- python-language-server
Expand Down
2 changes: 1 addition & 1 deletion ci/job.docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
pythons:
- name: ThreeSeven
spec: '>=3.7,<3.8.0a0'
lab: '>=2,<3.0.0a0'
lab: '>=2.2.0,<3.0.0a0'
nodejs: '>=12,<13.0.0a0'
env_update: conda env update -n jupyterlab-lsp --file env-test.yml --quiet
env_docs: conda env update -n jupyterlab-lsp --file requirements/docs.yml --quiet
Expand Down
2 changes: 1 addition & 1 deletion ci/job.lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ parameters:
pythons:
- name: ThreeSeven
spec: '>=3.7,<3.8.0a0'
lab: '>=2,<3.0.0a0'
lab: '>=2.2.0,<3.0.0a0'
nodejs: '>=12,<13.0.0a0'
env_update: conda env update -n jupyterlab-lsp --file env-test.yml --quiet
env_lint: conda env update -n jupyterlab-lsp --file requirements/lint.yml --quiet
Expand Down
16 changes: 11 additions & 5 deletions ci/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ parameters:
pythons:
- name: ThreeSix
spec: '=3.6'
lab: '>=2.1.0,<3.0.0a0'
lab: '>=2.2.0,<3.0.0a0'
nodejs: '>=10,<11.0.0.a0'
- name: ThreeSeven
spec: '=3.7'
lab: '>=2.1.0,<3.0.0a0'
lab: '>=2.2.0,<3.0.0a0'
nodejs: '>=12,<13.0.0a0'
- name: ThreeEight
spec: '=3.8'
lab: '>=2.1.0,<3.0.0a0'
lab: '>=2.2.0,<3.0.0a0'
nodejs: '>=13,<14.0.0a0'
js_cov_packages:
- jupyterlab-go-to-definition
Expand Down Expand Up @@ -88,8 +88,14 @@ jobs:
summaryFileLocation: 'packages/${{ js_package }}/coverage/cobertura-coverage.xml'
condition: always()

- script: ${{ platform.activate }} && jupyter serverextension list
displayName: list server extensions
- script: ${{ platform.activate }} && jupyter kernelspec list
displayName: list kernels

- script: ${{ platform.activate }} && jupyter lsp kernelspec install
displayName: install kernel

- script: ${{ platform.activate }} && jupyter kernelspec list
displayName: list kernels (again)

- script: ${{ platform.activate }} && python scripts/utest.py --test-run-title="Pytest ${{ platform.name }}${{ python.name }}"
displayName: run python tests
Expand Down
2 changes: 1 addition & 1 deletion docs/Architecture.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.5"
"version": "3.7.6"
}
},
"nbformat": 4,
Expand Down
Loading