From 8b0dc3de42139f7acd59247df39a6f8b0ff04f9d Mon Sep 17 00:00:00 2001 From: Philipp Rudiger Date: Sun, 27 Mar 2022 12:51:45 +0200 Subject: [PATCH] Branch 0.12.7 (#3263) * Fix jinja2 imports (#3258) * fix: wrong offset when memoryview format is non-byte (#3206) the offset should be in bytes, not elements. See also https://github.com/bokeh/ipywidgets_bokeh/issues/46#issuecomment-1046292704 * Support jupyter server root_dir with lab extension (#3172) Jupyter sends path relative to the root_dir which can be different from the cwd. This commit fixes the lab extension for panel preview to account for root_dir. Reference: #3170 * DOC: add note on enabling panel widget on Jupyter Lab (#3029) * Remove redundant and confusing JupyterLab install instructions (#3037) * Remove reference to Python 2 and link to Travis * Remove redondant install instructions to work with Jupyter * Update CHANGELOG * Add setuptools to build requirements * use https instead of the git:// protocol in GHA (#3092) * Try to switch to setuptools (#3138) * Try to switch to setuptools * Continue on error * CI: fix Macos tests workflow (#3160) * attempt to fix CI on macos * forgot bokeh channel * remove strict setting * reset strict and add pyctdev channel * remove continue_on_error and test py310 * clean up test workflow * add comment about PYCTDEV_SELF_CHANNEL * remove py310 * Revert change to build backend * Update setuptools pin * Pin setuptools * Further pin updates * Pin setuptools (#3265) * Fix image_url test * Pin pyvista * Bump panel.js version * Fix GH workflows * Bump panel.js version Co-authored-by: Maarten Breddels Co-authored-by: Govinda Totla Co-authored-by: Ray Bell Co-authored-by: Maxime Liquet <35924738+maximlt@users.noreply.github.com> --- .github/workflows/build.yaml | 4 ++-- .github/workflows/docs.yaml | 2 +- .github/workflows/test.yaml | 25 +++++++++++++------------ CHANGELOG.md | 20 ++++++++++++++++++++ doc/FAQ.rst | 3 +++ doc/getting_started/index.rst | 7 +------ doc/releases.md | 21 +++++++++++++++++++++ panel/io/ipywidget.py | 2 +- panel/io/jupyter_server_extension.py | 14 ++++++++++++++ panel/io/resources.py | 4 +++- panel/package-lock.json | 4 ++-- panel/package.json | 2 +- panel/tests/pane/test_image.py | 6 +----- pyproject.toml | 4 ++-- setup.py | 9 ++++++--- 15 files changed, 91 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9e4cbd7e25..f11bd6698d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -45,7 +45,7 @@ jobs: - name: conda setup run: | conda config --set always_yes True - conda install "pip<21.2.1" + conda install "pip<21.2.1" "setuptools<61" conda install -c pyviz "pyctdev>=0.5" doit ecosystem_setup - name: conda build @@ -111,7 +111,7 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate test-environment - conda install ${{ env.CHANS_DEV }} "pip<21.2.1" + conda install ${{ env.CHANS_DEV }} "pip<21.2.1" "setuptools<61" doit develop_install $CHANS_DEV -o build pip uninstall -y panel doit pip_on_conda diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 103fb4844e..e381b8bdfc 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -57,7 +57,7 @@ jobs: run: | eval "$(conda shell.bash hook)" conda activate test-environment - conda install ${{ env.CHANS_DEV }} "pip<21.2.1" + conda install ${{ env.CHANS_DEV }} "pip<21.2.1" "setuptools<61" conda list doit develop_install ${{ env.CHANS_DEV}} -o doc -o examples pip install pydeck sphinxcontrib-napoleon sphinx-copybutton pyecharts diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 58553cb551..4c9b875d2b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -25,12 +25,13 @@ jobs: shell: bash -l {0} env: DESC: "Python ${{ matrix.python-version }} tests" - HV_REQUIREMENTS: "unit_tests" PYTHON_VERSION: ${{ matrix.python-version }} - CHANS_DEV: "-c pyviz/label/dev -c bokeh/label/dev -c conda-forge" - CHANS: "-c pyviz -c bokeh/label/dev -c conda-forge" DISPLAY: ":99.0" GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Without this env var `doit env_create ...` uses by default + # the `pyviz` channel, except that we don't want to configure + # it as one of the sources. + PYCTDEV_SELF_CHANNEL: "pyviz/label/dev" steps: - uses: actions/checkout@v2 with: @@ -41,31 +42,31 @@ jobs: - uses: conda-incubator/setup-miniconda@v2 with: miniconda-version: "latest" + channel-priority: strict + channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults - name: Fetch unshallow run: git fetch --prune --tags --unshallow - name: conda setup run: | - conda config --set always_yes True - conda install -c pyviz "pyctdev>=0.5" - doit ecosystem_setup - conda install -c conda-forge "nodejs=15.3.0" - doit env_create ${{ env.CHANS_DEV}} --python=${{ matrix.python-version }} + conda install "pyctdev>=0.5" + conda install "nodejs=15.3.0" + doit env_create --python=${{ matrix.python-version }} - name: nix_opengl if: contains(matrix.os, 'ubuntu') run: | eval "$(conda shell.bash hook)" conda activate test-environment sudo apt-get install libglu1-mesa - conda install -c conda-forge mesalib + conda install mesalib /sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x24 sleep 3 - name: doit develop_install run: | eval "$(conda shell.bash hook)" conda activate test-environment - conda install ${{ env.CHANS_DEV }} "pip<21.2.1" + conda install "pip<21.2.1" "setuptools<61" conda list - doit develop_install ${{ env.CHANS_DEV}} -o examples -o recommended -o tests -o build + doit develop_install -o examples -o recommended -o tests -o build pip install pyecharts idom bokeh sampledata echo "-----" @@ -73,7 +74,7 @@ jobs: - name: windows_opengl if: contains(matrix.os, 'windows') run: | - git clone --depth 1 git://github.com/pyvista/gl-ci-helpers.git + git clone --depth 1 https://github.com/pyvista/gl-ci-helpers.git powershell gl-ci-helpers/appveyor/install_opengl.ps1 - name: doit env_capture run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index c587766fa0..7e01a5f094 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,25 @@ # Releases +## Version 0.12.7 + +Date: 2022-03-26 + +The 0.12.7 release primarily fixes an incompatibility with the new jinja2 3.1.0 release. Many thanks to @maartenbreddels, @govinda18, @raybellwaves and the maintainers @maximlt and @philippjfr for contributing further fixes to this release. + +Bug fixes: + +- Wrong offset when memoryview format is non-byte ([#3206](https://github.com/holoviz/panel/pull/3206)) +- Support jupyter server root_dir with lab extension ([#3172](https://github.com/holoviz/panel/pull/3172)) + +Docs: + +- add note on enabling panel widget on Jupyter Lab ([#3029](https://github.com/holoviz/panel/pull/3029)) +- Remove redundant and confusing JupyterLab install instructions ([#3037](https://github.com/holoviz/panel/pull/3037)) + +Compatibility: + +- Fix jinja2 imports ([#3258](https://github.com/holoviz/panel/pull/3258)) + ## Version 0.12.6 Date: 2021-12-08 diff --git a/doc/FAQ.rst b/doc/FAQ.rst index a542d517dd..5cac87e074 100644 --- a/doc/FAQ.rst +++ b/doc/FAQ.rst @@ -42,6 +42,9 @@ Conversely, what Panel adds on top of Bokeh is full bidirectional communication **A:** This error usually means that you forgot to run panel.extension() in a notebook context to set up the code for communicating between JavaScript and Python. It's easy to get confused and think you don't need that line, because notebooks will often work fine as long as *some* notebook somewhere in your Jupyter session has run the command, but the only reliable way to make the communication channels available is to make sure *every* notebook includes this command. +**Q: How do I enable the panel widget on Jupyter Lab?** + +**A:** Run `jupyter serverextension enable panel.io.jupyter_server_extension`. **Q: Why is my object being shown using the wrong type of pane?** diff --git a/doc/getting_started/index.rst b/doc/getting_started/index.rst index 8fec681533..66e03c60fe 100644 --- a/doc/getting_started/index.rst +++ b/doc/getting_started/index.rst @@ -11,7 +11,7 @@ Installation |CondaPyViz|_ |CondaDefaults|_ |PyPI|_ |License|_ -Panel works with `Python 2.7 and Python 3 `_ on Linux, Windows, or Mac. The recommended way to install Panel is using the `conda `_ command provided by `Anaconda `_ or `Miniconda `_:: +Panel works with Python 3 on Linux, Windows, or Mac. The recommended way to install Panel is using the `conda `_ command provided by `Anaconda `_ or `Miniconda `_:: conda install -c pyviz panel @@ -19,11 +19,6 @@ or using PyPI:: pip install panel -Support for classic Jupyter Notebook is included with Panel. If you want to work with JupyterLab, you will also need to install the optional PyViz JupyterLab extension:: - - conda install -c conda-forge jupyterlab - jupyter labextension install @pyviz/jupyterlab_pyviz - .. |CondaPyViz| image:: https://img.shields.io/conda/v/pyviz/panel.svg .. _CondaPyViz: https://anaconda.org/pyviz/panel diff --git a/doc/releases.md b/doc/releases.md index cf0a6801b0..a4d681415a 100644 --- a/doc/releases.md +++ b/doc/releases.md @@ -1,5 +1,26 @@ # Releases +## Version 0.12.7 + +Date: 2022-03-26 + +The 0.12.7 release primarily fixes an incompatibility with the new jinja2 3.1.0 release. Many thanks to @maartenbreddels, @govinda18, @raybellwaves and the maintainers @maximlt and @philippjfr for contributing further fixes to this release. + +Bug fixes: + +- Wrong offset when memoryview format is non-byte ([#3206](https://github.com/holoviz/panel/pull/3206)) +- Support jupyter server root_dir with lab extension ([#3172](https://github.com/holoviz/panel/pull/3172)) + +Docs: + +- add note on enabling panel widget on Jupyter Lab ([#3029](https://github.com/holoviz/panel/pull/3029)) +- Remove redundant and confusing JupyterLab install instructions ([#3037](https://github.com/holoviz/panel/pull/3037)) + +Compatibility: + +- Fix jinja2 imports ([#3258](https://github.com/holoviz/panel/pull/3258)) + + ## Version 0.12.6 Date: 2021-12-07 diff --git a/panel/io/ipywidget.py b/panel/io/ipywidget.py index 6d9f22f74c..f3121cee3c 100644 --- a/panel/io/ipywidget.py +++ b/panel/io/ipywidget.py @@ -28,7 +28,7 @@ def send(self, stream, msg_type, content=None, parent=None, ident=None, buffers= offsets = [start] for buffer in buffers[:-1]: - start += len(buffer) + start += memoryview(buffer).nbytes offsets.append(start) u32 = lambda n: n.to_bytes(4, "big") diff --git a/panel/io/jupyter_server_extension.py b/panel/io/jupyter_server_extension.py index bff7e164b8..4f04b64d12 100644 --- a/panel/io/jupyter_server_extension.py +++ b/panel/io/jupyter_server_extension.py @@ -1,6 +1,7 @@ from urllib.parse import urljoin import tornado +import os from bokeh.command.util import build_single_handler_application from bokeh.embed.bundle import extension_dirs @@ -65,6 +66,17 @@ class ServerApplicationProxy: def __init__(self, app, **kw): self._app = app + @property + def root_dir(self): + """ + Gets the root directory of the jupyter server app + + This is useful as the path sent received by the handler + may be different from the root dir. + Reference: https://github.com/holoviz/panel/issues/3170 + """ + return self._app.settings['server_root_dir'] + def __getattr__(self, key): return getattr(self._app, key) @@ -81,6 +93,7 @@ def initialize(self, *args, **kws): pass async def get(self, path, *args, **kwargs): + path = os.path.join(self.application.root_dir, path) if path in _APPS: app, context = _APPS[path] else: @@ -122,6 +135,7 @@ def initialize(self, *args, **kwargs): pass async def open(self, path, *args, **kwargs): + path = os.path.join(self.application.root_dir, path) _, context = _APPS[path] token = self._token diff --git a/panel/io/resources.py b/panel/io/resources.py index 27affc8147..219da1a179 100644 --- a/panel/io/resources.py +++ b/panel/io/resources.py @@ -21,7 +21,9 @@ from bokeh.resources import Resources as BkResources from bokeh.settings import settings as _settings -from jinja2 import Environment, Markup, FileSystemLoader +from markupsafe import Markup +from jinja2.environment import Environment +from jinja2.loaders import FileSystemLoader from ..util import url_path from .state import state diff --git a/panel/package-lock.json b/panel/package-lock.json index d4e3b796ab..27cf2df100 100644 --- a/panel/package-lock.json +++ b/panel/package-lock.json @@ -1,12 +1,12 @@ { "name": "@holoviz/panel", - "version": "0.12.6", + "version": "0.12.7-rc.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@holoviz/panel", - "version": "0.12.6", + "version": "0.12.7-rc.2", "license": "BSD-3-Clause", "dependencies": { "@bokeh/bokehjs": "^2.4.2", diff --git a/panel/package.json b/panel/package.json index 5d22b4abc5..239a763bd7 100644 --- a/panel/package.json +++ b/panel/package.json @@ -1,6 +1,6 @@ { "name": "@holoviz/panel", - "version": "0.12.6", + "version": "0.12.7-rc.2", "description": "A high level dashboarding library for python visualization libraries.", "license": "BSD-3-Clause", "repository": { diff --git a/panel/tests/pane/test_image.py b/panel/tests/pane/test_image.py index 318e8b1a2f..13d9903e6c 100644 --- a/panel/tests/pane/test_image.py +++ b/panel/tests/pane/test_image.py @@ -92,13 +92,12 @@ def test_load_from_stringio(): def test_loading_a_image_from_url(): """Tests the loading of a image from a url""" - url = 'https://file-examples-com.github.io/uploads/2017/10/file_example_PNG_500kB.png' + url = 'https://raw.githubusercontent.com/holoviz/panel/master/doc/_static/logo.png' image_pane = PNG(url) image_data = image_pane._data() assert b'PNG' in image_data - def test_loading_a_image_from_pathlib(): """Tests the loading of a image from a pathlib""" filepath = Path(__file__).parent.parent / "test_data" / "logo.png" @@ -107,7 +106,6 @@ def test_loading_a_image_from_pathlib(): image_data = image_pane._data() assert b'PNG' in image_data - def test_image_alt_text(document, comm): """Tests the loading of a image from a url""" url = 'https://file-examples-com.github.io/uploads/2017/10/file_example_PNG_500kB.png' @@ -117,7 +115,6 @@ def test_image_alt_text(document, comm): assert 'alt="Some alt text"' in model.text - def test_image_link_url(document, comm): """Tests the loading of a image from a url""" url = 'https://file-examples-com.github.io/uploads/2017/10/file_example_PNG_500kB.png' @@ -127,7 +124,6 @@ def test_image_link_url(document, comm): assert model.text.startswith('<a href="http://anaconda.org"') - def test_pdf_embed(document, comm): pdf_pane = PDF('https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf') model = pdf_pane.get_root(document, comm) diff --git a/pyproject.toml b/pyproject.toml index 8007d0bef0..f80c695bae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,11 +2,11 @@ requires = [ "param >=1.9.0", "pyct >=0.4.4", - "setuptools >=30.3.0", + "setuptools >=42,<61", "bokeh >=2.4.0,<2.5.0", "pyviz_comms >=0.6.0", "requests", "bleach", "packaging", "tqdm >=4.48.0" -] +] \ No newline at end of file diff --git a/setup.py b/setup.py index 2b24ecea37..cb02d5d7cb 100644 --- a/setup.py +++ b/setup.py @@ -99,6 +99,7 @@ def run(self): install_requires = [ 'bokeh >=2.4.0,<2.5.0', 'param >=1.10.0', + 'setuptools >=42,<61', 'pyviz_comms >=0.7.4', 'markdown', 'requests', @@ -144,7 +145,7 @@ def run(self): 'jupyter_bokeh >=3.0.2', 'django <4', 'channels', - 'pyvista', + 'pyvista <0.33', 'ipywidgets', 'ipywidgets_bokeh', 'ipyvolume', @@ -170,8 +171,8 @@ def run(self): extras_require['build'] = [ 'param >=1.9.2', 'pyct >=0.4.4', - 'setuptools >=30.3.0', - 'bokeh >=2.0.0', + 'setuptools >=42,<61', + 'bokeh >=2.4.0,<2.5.0', 'pyviz_comms >=0.6.0', 'bleach', 'tqdm' @@ -207,6 +208,8 @@ def run(self): "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", "Operating System :: OS Independent", "Intended Audience :: Developers", "Intended Audience :: Science/Research",