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

Add notebook dependency to CI to test serverextension, fix CI #869

Merged
merged 10 commits into from
Dec 11, 2022
30 changes: 15 additions & 15 deletions .github/workflows/job.test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:
lab: ['>=3.3.0,<4.0.0a0']
r: ['>=4']
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: cschleiden/replace-tokens@v1
with:
Expand Down Expand Up @@ -158,7 +158,6 @@ jobs:
miniforge-variant: Mambaforge

- name: Install minimal build deps
shell: bash -l {0}
run: mamba install -n test -c conda-forge setuptools wheel 'jupyterlab${{ matrix.lab }}' 'nodejs${{ matrix.nodejs }}'

- name: Cache node_modules
Expand Down Expand Up @@ -210,7 +209,7 @@ jobs:
sha256sum * | tee SHA256SUMS

- name: Publish builds
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: jupyterlab-lsp dist ${{ github.run_number }}
path: ./dist
Expand Down Expand Up @@ -239,7 +238,7 @@ jobs:
lab: '>=3.4.0,<4'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set JupyterLab and Node versions
uses: cschleiden/replace-tokens@v1
Expand Down Expand Up @@ -297,7 +296,7 @@ jobs:
key: |
${{ env.CACHE_EPOCH }}-julia-test-${{ runner.os }}-${{ env.JULIA_LANGSERVER }}

- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: jupyterlab-lsp dist ${{ github.run_number }}
path: ./dist
Expand Down Expand Up @@ -395,11 +394,11 @@ jobs:
py_cmd: python
steps:
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: jupyterlab-lsp dist ${{ github.run_number }}
path: ./dist
Expand All @@ -415,10 +414,10 @@ jobs:
- name: Validate the install
run: |
set -eux
jupyter labextension list
jupyter server extension list
jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" -
jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -
${{ matrix.py_cmd }} -m jupyter labextension list
${{ matrix.py_cmd }} -m jupyter server extension list
${{ matrix.py_cmd }} -m jupyter labextension list 2>&1 | grep -ie "jupyterlab-lsp.*enabled.*ok" -
${{ matrix.py_cmd }} -m jupyter server extension list 2>&1 | grep -ie "jupyter_lsp.*enabled" -

source:
name: smoke source install ${{ matrix.os }} py${{ matrix.python }} lab${{ matrix.lab }}
Expand All @@ -437,23 +436,24 @@ jobs:
lab: '>=3.3,<4'
steps:
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: 'x64'
- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.nodejs }}
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v3
with:
name: jupyterlab-lsp dist ${{ github.run_number }}
path: ./dist
- name: Install the prerequisites
run: python -m pip install --upgrade pip wheel setuptools
- name: Install JupyterLab
shell: bash -l {0}
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 Down
2 changes: 1 addition & 1 deletion atest/01_Editor.robot
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Resource Variables.resource

Suite Setup Setup Suite For Screenshots editor

Force Tags ui:editor aspect:ls:features
Test Tags ui:editor aspect:ls:features


*** Test Cases ***
Expand Down
13 changes: 11 additions & 2 deletions atest/04_Interface/BackendFailure.robot
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
*** Settings ***
Resource ../Keywords.resource

Suite Setup Setup Server and Browser server_extension_enabled=${False}
Suite Teardown Setup Server and Browser server_extension_enabled=${True}
Suite Setup Setup Missing Extension Test
Suite Teardown Teardown Missing Extension Test


*** Variables ***
Expand All @@ -19,3 +19,12 @@ Handles Server Extension Failure
Accept Default Dialog Option
Page Should Not Contain Element ${POPOVER}
[Teardown] Clean Up After Working With File Python.ipynb


*** Keywords ***
Setup Missing Extension Test
Set Server Extension State enabled=${False}
Setup Server and Browser

Teardown Missing Extension Test
Set Server Extension State enabled=${True}
2 changes: 1 addition & 1 deletion atest/04_Interface/DiagnosticsPanel.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots diagnostics_panel
Test Setup Set Up
Test Teardown Clean Up

Force Tags ui:notebook aspect:ls:features
Test Tags ui:notebook aspect:ls:features


*** Variables ***
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 @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots completion
Test Setup Setup Completion Test
Test Teardown Clean Up After Working With File Completion.ipynb

Force Tags feature:completion
Test Tags feature:completion


*** Variables ***
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Diagnostics.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots diagnostics
Test Setup Setup Notebook Python Diagnostic.ipynb
Test Teardown Clean Up After Working With File Diagnostic.ipynb

Force Tags feature:diagnostics
Test Tags feature:diagnostics
# note: diagnostics are also tested in 01_Editor and 04_Interface/DiagnosticsPanel.robot


Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Highlights.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots highlights
Test Setup Setup Highlights Test
Test Teardown Clean Up After Working With File Highlights.ipynb

Force Tags feature:highlights
Test Tags feature:highlights


*** Test Cases ***
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Hover.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Suite Setup Setup Suite For Screenshots hover
Test Setup Setup Hover Test
Test Teardown Clean Up After Working With File Hover.ipynb

Force Tags feature:hover
Test Tags feature:hover


*** Variables ***
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Jump.robot
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Resource ../Keywords.resource

Suite Setup Setup Suite For Screenshots gh-403

Force Tags feature:jump-to-definition gh:403
Test Tags feature:jump-to-definition gh:403


*** Variables ***
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Signature.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots signature
Test Setup Setup Notebook Python Signature.ipynb
Test Teardown Clean Up After Working With File Signature.ipynb

Force Tags feature:signature
Test Tags feature:signature


*** Variables ***
Expand Down
2 changes: 1 addition & 1 deletion atest/05_Features/Syntax_highlighting.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Suite Setup Setup Suite For Screenshots syntax_highlighting
Test Setup Setup Highlighting Test
Test Teardown Clean Up After Working With File Syntax highlighting.ipynb

Force Tags feature:syntax_highlighting
Test Tags feature:syntax_highlighting


*** Test Cases ***
Expand Down
2 changes: 1 addition & 1 deletion atest/06_Style.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Library Collections

Suite Setup Setup Suite For Screenshots style

Force Tags ui:editor aspect:style
Test Tags ui:editor aspect:style


*** Variables ***
Expand Down
2 changes: 1 addition & 1 deletion atest/07_Configuration.robot
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Resource ./Keywords.resource

Suite Setup Setup Suite For Screenshots config

Force Tags feature:config
Test Tags feature:config


*** Test Cases ***
Expand Down
32 changes: 17 additions & 15 deletions atest/Keywords.resource
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@ Library ./config.py

*** Keywords ***
Setup Server and Browser
[Arguments] ${server_extension_enabled}=${True}
Initialize Global Variables
Create Notebok Server Config ${server_extension_enabled}
Create Notebok Server Config
Initialize User Settings
${disable_global_config} = Set Variable If ${server_extension_enabled} != ${True} '1' ${EMPTY}
${server} = Start Process jupyter-lab
... cwd=${NOTEBOOK DIR}
... stdout=${LAB LOG}
... stderr=STDOUT
... env:HOME=${HOME}
... env:JUPYTER_NO_CONFIG=${disable_global_config}
... env:JUPYTER_NO_CONFIG=${EMPTY}
Set Global Variable ${SERVER} ${server}
Open JupyterLab
Read Page Config
Expand All @@ -39,8 +37,10 @@ Initialize Global Variables

Create Notebok Server Config
[Documentation] Copies in notebook server config file and updates accordingly
[Arguments] ${server_extension_enabled}=${True}
${conf} = Set Variable ${NOTEBOOK DIR}${/}${JPSERVER CONF JSON}
Set Environment Variable
... name=JUPYTER_CONFIG_DIR
... value=${NOTEBOOK DIR}
${extra_node_roots} = Create List ${ROOT}
${port} = Get Unused Port
Set Global Variable ${PORT} ${port}
Expand All @@ -55,19 +55,21 @@ Create Notebok Server Config
Update Jupyter Config ${conf} LabApp
... user_settings_dir=${SETTINGS DIR}
... workspaces_dir=${WORKSPACES DIR}
# should be automatically enabled, so do not enable manually:
IF not ${server_extension_enabled}
Set Server Extension State ${conf} enabled=${server_extension_enabled}
END
Update Jupyter Config ${conf} LanguageServerManager
... extra_node_roots=@{extra_node_roots}

Set Server Extension State
[Arguments] ${conf} ${enabled}=${True}
${extension_state} = Create Dictionary enabled=${enabled}
${extensions} = Create Dictionary jupyter_lsp=${extension_state}
Update Jupyter Config ${conf} LabApp
... jpserver_extensions=${extensions}
[Arguments] ${enabled}=${True}
Set Environment Variable
... name=JUPYTER_CONFIG_DIR
... value=${NOTEBOOK DIR}
IF ${enabled}
Run Process jupyter server extension enable jupyter_lsp
... shell=yes
ELSE
Run Process jupyter server extension disable jupyter_lsp
... shell=yes
END

Read Page Config
${script} = Get Element Attribute id:jupyter-config-data innerHTML
Expand Down Expand Up @@ -217,7 +219,7 @@ Ensure Sidebar Is Closed
END

Refresh File List
IF '${LAB VERSION}'.startswith('3.4')
IF [int(part) for part in "${LAB VERSION}".split(".")] >= [3, 4, 0]
Click Element ${JLAB CSS REFRESH FILES}
ELSE
Click Element ${JLAB CSS REFRESH F_OLD}
Expand Down
2 changes: 1 addition & 1 deletion atest/__init__.robot
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Suite Teardown Tear Down Everything
Test Setup Reset Application State
Test Teardown Lab Log Should Not Contain Known Error Messages

Force Tags os:${os.lower()} py:${py}
Test Tags os:${os.lower()} py:${py}
2 changes: 1 addition & 1 deletion atest/examples/example.robot
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*** Settings ***
Library SeleniumLibrary
Force Tags atest:example
Test Tags atest:example

*** Variables ***
${ABC} abc
Expand Down
40 changes: 22 additions & 18 deletions docs/Language Servers.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,14 @@
"source": [
"### Servers tested with Notebooks\n",
"\n",
"While most servers should work with notebooks and standalone files, some\n",
"require additional adjustments. The following language servers are tested\n",
"against `jupyterlab-lsp` and any issues when using them in notebooks\n",
"will be prioritised.\n",
"While most servers should work with notebooks and standalone files, some require\n",
"additional adjustments. The following language servers are tested against\n",
"`jupyterlab-lsp` and any issues when using them in notebooks will be\n",
"prioritised.\n",
"\n",
"If you choose to install multiple language servers for the same language, the one with the highest\n",
"`priority` (which can be set in the _Advanced Settings Editor_) will be used."
"If you choose to install multiple language servers for the same language, the\n",
"one with the highest `priority` (which can be set in the _Advanced Settings\n",
"Editor_) will be used."
]
},
{
Expand Down Expand Up @@ -341,24 +342,26 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Servers and extensions listed below are not included in the testing suite of `jupyterlab-lsp`; the support may be provided by community members or a third-party:"
"Servers and extensions listed below are not included in the testing suite of\n",
"`jupyterlab-lsp`; the support may be provided by community members or a\n",
"third-party:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"| Languages | Implementation | Comment |\n",
"|---------------------------|-------------------------------------------|---------------|\n",
"| Spark SQL | [CybercentreCanada/jupyterlab-sql-editor] | |\n",
"| GraphQL, SPARQL, Turtle | [jupyrdf/graph-lsp] | |\n",
"| JSON | [jupyter-lsp/json-lsp] | (1) |\n",
"| YAML | [jupyter-lsp/yaml-lsp] | (1) |\n",
"| Scala | [scalameta/metals] | (2) |\n",
"\n",
"| Languages | Implementation | Comment |\n",
"| ----------------------- | ----------------------------------------- | ------- |\n",
"| Spark SQL | [CybercentreCanada/jupyterlab-sql-editor] | |\n",
"| GraphQL, SPARQL, Turtle | [jupyrdf/graph-lsp] | |\n",
"| JSON | [jupyter-lsp/json-lsp] | (1) |\n",
"| YAML | [jupyter-lsp/yaml-lsp] | (1) |\n",
"| Scala | [scalameta/metals] | (2) |\n",
"\n",
"[jupyrdf/graph-lsp]: https://github.com/jupyrdf/graph-lsp\n",
"[CybercentreCanada/jupyterlab-sql-editor]: https://github.com/CybercentreCanada/jupyterlab-sql-editor\n",
"[CybercentreCanada/jupyterlab-sql-editor]:\n",
" https://github.com/CybercentreCanada/jupyterlab-sql-editor\n",
"[jupyter-lsp/json-lsp]: https://github.com/jupyter-lsp/json-lsp\n",
"[jupyter-lsp/yaml-lsp]: https://github.com/jupyter-lsp/yaml-lsp\n",
"[scalameta/metals]: https://github.com/scalameta/metals"
Expand All @@ -369,8 +372,9 @@
"metadata": {},
"source": [
"- (1) convenience wrappers for installation with `pip`, require Node.js.\n",
"- (2) `metals` is not currently auto-detected, but can be configured as demonstrated in the\n",
"[configuration example](./Configuring.html#example-scala-language-server-metals-integration)."
"- (2) `metals` is not currently auto-detected, but can be configured as\n",
" demonstrated in the\n",
" [configuration example](./Configuring.html#example-scala-language-server-metals-integration)."
]
},
{
Expand Down
2 changes: 2 additions & 0 deletions requirements/github-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ channels:

dependencies:
- jupyterlab {lab}
# to test serverextension
- notebook
# build dependencies
- pip
- nodejs {nodejs}
Expand Down