From 1e36145dcd7640b631fd92a706adf807ed9a36b5 Mon Sep 17 00:00:00 2001 From: David Brochart Date: Tue, 11 Feb 2020 16:43:02 +0100 Subject: [PATCH 01/20] Async cell execution --- .github/workflows/main.yml | 12 ++--- .travis.yml | 6 +-- setup.py | 6 ++- .../default/nbconvert_templates/lab.tpl | 2 +- .../default/nbconvert_templates/voila.tpl | 2 +- voila/app.py | 4 +- voila/execute.py | 31 +++++------ voila/exporter.py | 25 ++------- voila/handler.py | 38 ++++++++------ voila/threading.py | 51 ------------------- 10 files changed, 58 insertions(+), 119 deletions(-) delete mode 100644 voila/threading.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 70aca8172..55f7ba384 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: [3.5, 3.6, 3.7] + python-version: [3.6, 3.7, 3.8] steps: - uses: actions/checkout@v1 @@ -34,25 +34,25 @@ jobs: - name: Update conda run: | conda update -y -n base conda setuptools - + - name: Init conda run: | conda init bash conda info -a - name: Create the conda environment - run: conda create -q -y -n voila-tests -c conda-forge python=$PYTHON_VERSION pip jupyterlab_pygments==0.1.0 nbconvert=5.5 pytest-cov nodejs flake8 ipywidgets matplotlib xeus-cling + run: conda create -q -y -n voila-tests -c conda-forge python=$PYTHON_VERSION pip jupyterlab_pygments==0.1.0 pytest-cov nodejs flake8 ipywidgets matplotlib xeus-cling env: PYTHON_VERSION: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install dependencies run: | source "$CONDA/etc/profile.d/conda.sh" conda activate voila-tests whereis python python --version - - python -m pip install ".[test]" + + python -m pip install --ignore-installed ".[test]" cd tests/test_template; pip install .; cd ../../; - name: Flake8 diff --git a/.travis.yml b/.travis.yml index 32a733d9e..168ad5d4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ os: - osx env: matrix: - - PYTHON_VERSION=3.5 - PYTHON_VERSION=3.6 - PYTHON_VERSION=3.7 + - PYTHON_VERSION=3.8 before_install: - if [[ $TRAVIS_OS_NAME == osx ]]; then ulimit -n 2048; fi - if [[ $TRAVIS_OS_NAME == linux ]]; then sudo apt-get update; fi @@ -18,10 +18,10 @@ before_install: - conda config --set always_yes yes --set changeps1 no - conda update -q conda - conda info -a - - conda create -q -n test-environment -c conda-forge python=$PYTHON_VERSION jupyterlab_pygments==0.1.0 nbconvert=5.5 pytest-cov nodejs flake8 ipywidgets matplotlib xeus-cling + - conda create -q -n test-environment -c conda-forge python=$PYTHON_VERSION jupyterlab_pygments==0.1.0 pytest-cov nodejs flake8 ipywidgets matplotlib xeus-cling - source activate test-environment install: - - pip install ".[test]" + - pip install --ignore-installed ".[test]" - cd tests/test_template; pip install .; cd ../../; script: - VOILA_TEST_DEBUG=1 VOILA_TEST_XEUS_CLING=1 py.test tests/ --async-test-timeout=240 diff --git a/setup.py b/setup.py index ad7a1b445..dd49cd4b1 100644 --- a/setup.py +++ b/setup.py @@ -377,7 +377,9 @@ def get_data_files(): 'install_requires': [ 'async_generator', 'jupyter_server>=0.1.0,<0.2.0', - 'nbconvert>=5.5.0,<6', + 'jupyter_client>=6.0.0', + 'nbclient @ git+https://github.com/jupyter/nbclient', + 'nbconvert @ git+https://github.com/jupyter/nbconvert', 'jupyterlab_pygments>=0.1.0,<0.2', 'pygments>=2.4.1,<3' # Explicitly requiring pygments which is a second-order dependency. # An older versions is generally installed already and is otherwise not updated by pip. @@ -385,7 +387,7 @@ def get_data_files(): 'extras_require': { 'test': [ 'mock', - 'pytest<4', + 'pytest', 'pytest-tornado', 'matplotlib', 'ipywidgets' diff --git a/share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl b/share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl index c06cdf7d4..7ea3040b8 100644 --- a/share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl +++ b/share/jupyter/voila/templates/default/nbconvert_templates/lab.tpl @@ -1,4 +1,4 @@ -{%- extends 'display_priority.tpl' -%} +{%- extends 'display_priority.j2' -%} {% block codecell %} {%- if not cell.outputs -%} diff --git a/share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl b/share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl index f9bf5409e..1e274cdfe 100644 --- a/share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl +++ b/share/jupyter/voila/templates/default/nbconvert_templates/voila.tpl @@ -62,7 +62,7 @@ a.anchor-link { {%- block body_loop -%} {# from this point on, the kernel is started #} - {%- with kernel_id = kernel_start() -%} + {%- with kernel_id = kernel_start(nb) -%}