Skip to content

Commit

Permalink
Migrating to jupyter-server 2, jupyter_client 7.x (voila-dashboar…
Browse files Browse the repository at this point in the history
…ds#1308)

* Get changes from voila-dashboards#1283

Co-authored-by: Mike <[email protected]>

* Update tree handler

* Add token flag

* Update error template

* Fix types/node version issue

* Update binder build

---------

Co-authored-by: Mike <[email protected]>
(cherry picked from commit e30f6aa)
  • Loading branch information
trungleduc authored and martinRenou committed Jul 28, 2023
1 parent 64fa8ce commit 2992ac0
Show file tree
Hide file tree
Showing 14 changed files with 2,052 additions and 1,754 deletions.
3 changes: 2 additions & 1 deletion .binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: voila
channels:
- conda-forge
dependencies:
- jupyterlab=3
- jupyterlab=3.6
- ipywidgets=8
- ipyvolume
- bqplot
Expand All @@ -11,3 +11,4 @@ dependencies:
- ipympl
- xleaflet=0.16.0
- xeus-cling=0.13.0
- python=3.10
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:

- name: Create the conda environment
shell: bash -l {0}
run: mamba install -q python=${{ matrix.python_version }} pip jupyterlab_pygments==0.1.0 pytest-cov pytest-rerunfailures nodejs yarn=1 flake8 ipywidgets matplotlib xeus-cling "traitlets>=5.0.3,<6"
run: mamba install -q python=${{ matrix.python_version }} pip jupyterlab_pygments==0.1.0 pytest-cov pytest-rerunfailures nodejs=18 yarn=1 ipywidgets matplotlib xeus-cling "traitlets>=5.0.3,<6" ipykernel

- name: Install dependencies
shell: bash -l {0}
Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

- name: Create the conda environment
shell: bash -l {0}
run: mamba install -q python=${{ matrix.python_version }} pip jupyterlab_pygments==0.1.0 pytest-cov pytest-rerunfailures nodejs yarn=1 flake8 ipywidgets matplotlib xeus-cling "traitlets>=5.0.3,<6"
run: mamba install -q python=${{ matrix.python_version }} pip jupyterlab_pygments==0.1.0 pytest-cov pytest-rerunfailures nodejs=18 yarn=1 ipywidgets matplotlib xeus-cling "traitlets>=5.0.3,<6" ipykernel

- name: Install dependencies
shell: bash -l {0}
Expand Down Expand Up @@ -127,11 +127,11 @@ jobs:

- uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'

- name: Install dependencies
run: |
python -m pip install jupyterlab_pygments==0.1.0 pytest-cov pytest-rereunfailures flake8 ipywidgets matplotlib traitlets
python -m pip install jupyterlab_pygments==0.1.0 pytest-cov pytest-rerunfailures ipywidgets matplotlib traitlets ipykernel
yarn install --network-timeout 100000
python -m pip install ".[test]"
cd tests/test_template
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
"build:prod": "lerna run build:prod",
"build:test": "lerna run build:test",
"clean": "lerna run clean",
"eslint": "eslint . --ext .ts,.tsx,.js,.jsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx,.js,.jsx",
"eslint": "eslint . --ext .ts,.tsx --fix",
"eslint:check": "eslint . --ext .ts,.tsx",
"prettier": "prettier --write \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"prettier:check": "prettier --list-different \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
"test": "lerna run test"
Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ classifiers = [
"Programming Language :: Python :: 3.11",
]
dependencies = [
"jupyter_client>=6.1.3,<=7.4.1",
"jupyter_client>=7.4.4,<9",
"jupyter_core>=4.11.0",
"jupyter_server>=1.18,<2.0.0",
"jupyter_server>=2.0.0,<3",
"jupyterlab_server>=2.3.0,<3",
"nbclient>=0.4.0,<0.8",
"nbconvert>=6.4.5,<8",
Expand Down Expand Up @@ -65,7 +65,6 @@ test = [
"pandas",
"papermill",
"pytest",
"pytest-rerunfailures",
"pytest-tornasync",
]

Expand Down
9 changes: 9 additions & 0 deletions tests/app/shutdown_kernel_test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
import re
import pytest


@pytest.fixture
def voila_config():
def config(voila_app):
voila_app.tornado_settings["disable_check_xsrf"] = True

return config


async def test_shutdown_handler(http_server_client, base_url):
Expand Down
2 changes: 1 addition & 1 deletion tests/execute_output_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_execute_output():
path = os.path.join(BASE_DIR, 'notebooks/output.ipynb')
nb = read(path, NO_CONVERT)
nb_voila = deepcopy(nb)
executenb(nb_voila)
executenb(nb_voila, timeout=30)

widget_states = nb.metadata.widgets[WIDGET_MIME_TYPE_STATE]['state']
widget_states_voila = nb_voila.metadata.widgets[WIDGET_MIME_TYPE_STATE][
Expand Down
24 changes: 4 additions & 20 deletions tests/notebooks/output.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
],
"source": [
"import ipywidgets as widgets\n",
"from IPython.display import clear_output\n",
"output1 = widgets.Output()\n",
"output1"
]
Expand Down Expand Up @@ -79,7 +78,6 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"output2 = widgets.Output()\n",
"output2"
]
Expand All @@ -100,8 +98,7 @@
"source": [
"print(\"hi2\")\n",
"with output2:\n",
" print(\"in output2\")\n",
" clear_output(wait=True)"
" print(\"in output2\")\n"
]
},
{
Expand All @@ -126,7 +123,6 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"output3 = widgets.Output()\n",
"output3"
]
Expand All @@ -148,7 +144,6 @@
"print(\"hi3\")\n",
"with output3:\n",
" print(\"hello\")\n",
" clear_output(wait=True)\n",
" print(\"world\")"
]
},
Expand All @@ -174,7 +169,6 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"output4 = widgets.Output()\n",
"output4"
]
Expand All @@ -195,8 +189,7 @@
"source": [
"print(\"hi4\")\n",
"with output4:\n",
" print(\"hello world\")\n",
" clear_output()"
" print(\"hello world\")\n"
]
},
{
Expand All @@ -221,7 +214,6 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"output5 = widgets.Output()\n",
"output5"
]
Expand All @@ -234,8 +226,7 @@
"source": [
"print(\"hi5\")\n",
"with output5:\n",
" display(\"hello world\") # this is not a stream but plain text\n",
"clear_output()"
" display(\"hello world\") # this is not a stream but plain text\n"
]
},
{
Expand All @@ -260,7 +251,6 @@
}
],
"source": [
"import ipywidgets as widgets\n",
"output_outer = widgets.Output()\n",
"output_inner = widgets.Output()\n",
"output_inner"
Expand Down Expand Up @@ -296,13 +286,7 @@
"execution_count": 14,
"metadata": {},
"outputs": [],
"source": [
"with output_inner:\n",
" print('in inner')\n",
" with output_outer:\n",
" print('in outer')\n",
" print('also in inner')"
]
"source": []
},
{
"cell_type": "code",
Expand Down
Loading

0 comments on commit 2992ac0

Please sign in to comment.