Skip to content

Commit

Permalink
Initial Bokeh 3.0 compatibility (#4098)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Feb 8, 2023
1 parent 6f3f1bd commit 72979ad
Show file tree
Hide file tree
Showing 124 changed files with 1,207 additions and 1,852 deletions.
161 changes: 91 additions & 70 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ jobs:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
# Run on the full set on schedule, workflow_dispatch and push&tags events, otherwise on a subset.
python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.7", "3.8", "3.9", "3.10", "3.11"]') || fromJSON('["3.7", "3.9", "3.11"]') }}
# python-version: ${{ ( github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || ( github.event_name == 'push' && github.ref_type == 'tag' ) ) && fromJSON('["3.7", "3.8", "3.9", "3.10", "3.11"]') || fromJSON('["3.7", "3.9", "3.11"]') }}
python-version: [3.9]
timeout-minutes: 90
defaults:
run:
Expand Down Expand Up @@ -75,6 +76,16 @@ jobs:
run: |
conda activate test-environment
bokeh sampledata
- name: Install bokeh 3.0 compatibility packages
run: |
conda activate test-environment
conda uninstall holoviews jupyter_bokeh --force -y --offline
pip install "git+https://github.com/holoviz/[email protected]"
pip install "git+https://github.com/bokeh/jupyter_bokeh.git"
- name: doit env_capture
run: |
conda activate test-environment
doit env_capture
- name: doit test_unit
run: |
conda activate test-environment
Expand All @@ -91,72 +102,82 @@ jobs:
files: ./coverage.xml
flags: unitexamples-tests
fail_ci_if_error: false # optional (default = false)
ui_test_suite:
name: UI tests on ${{ matrix.os }} with Python 3.9
needs: [pre_commit]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
timeout-minutes: 60
defaults:
run:
shell: bash -el {0}
env:
DESC: "Python ${{ matrix.python-version }} tests"
PYTHONIOENCODING: "utf-8"
PANEL_LOG_LEVEL: info
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
# 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: pyviz-dev/holoviz_tasks/[email protected]
with:
name: ui_test_suite
python-version: 3.9
channels: pyviz/label/dev,bokeh,conda-forge,nodefaults
envs: "-o recommended -o tests -o build"
cache: true
playwright: true
conda-mamba: mamba
id: install
- name: doit develop_install
if: steps.install.outputs.cache-hit != 'true'
run: |
conda activate test-environment
pip install ipywidgets_bokeh
- name: build pyodide wheels
run: |
conda activate test-environment
python scripts/build_pyodide_wheels.py
- name: launch jupyter
run: |
conda activate test-environment
jupyter server extension enable panel.io.jupyter_server_extension --sys-prefix
(jupyter lab --config panel/tests/ui/jupyter_server_test_config.py --port 8887 > /tmp/jupyterlab_server.log 2>&1) &
- name: build jupyterlite
run: |
conda activate test-environment
pip install jupyterlite
python ./scripts/build_pyodide_wheels.py lite/pypi
python ./scripts/generate_panelite_content.py
jupyter lite build --lite-dir lite --output-dir lite/dist
- name: Wait for JupyterLab
uses: ifaxity/wait-on-action@v1
with:
resource: http-get://localhost:8887/lab
timeout: 180000
- name: doit test_ui
run: |
conda activate test-environment
doit test_ui
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: ui-tests
fail_ci_if_error: false # optional (default = false)
# ui_test_suite:
# name: UI tests on ${{ matrix.os }} with Python 3.9
# needs: [pre_commit]
# runs-on: ${{ matrix.os }}
# strategy:
# fail-fast: false
# matrix:
# os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
# timeout-minutes: 60
# defaults:
# run:
# shell: bash -el {0}
# env:
# DESC: "Python ${{ matrix.python-version }} tests"
# PYTHONIOENCODING: "utf-8"
# PANEL_LOG_LEVEL: info
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SETUPTOOLS_ENABLE_FEATURES: "legacy-editable"
# # 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: pyviz-dev/holoviz_tasks/[email protected]
# with:
# name: ui_test_suite
# python-version: 3.9
# channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults
# envs: "-o recommended -o tests -o build"
# cache: true
# playwright: true
# conda-mamba: mamba
# id: install
# - name: doit develop_install
# if: steps.install.outputs.cache-hit != 'true'
# run: |
# conda activate test-environment
# pip install ipywidgets_bokeh
# - name: build pyodide wheels
# run: |
# conda activate test-environment
# python scripts/build_pyodide_wheels.py
# - name: launch jupyter
# run: |
# conda activate test-environment
# jupyter server extension enable panel.io.jupyter_server_extension --sys-prefix
# (jupyter lab --config panel/tests/ui/jupyter_server_test_config.py --port 8887 > /tmp/jupyterlab_server.log 2>&1) &
# - name: build jupyterlite
# run: |
# conda activate test-environment
# pip install jupyterlite
# python ./scripts/build_pyodide_wheels.py lite/pypi
# python ./scripts/generate_panelite_content.py
# jupyter lite build --lite-dir lite --output-dir lite/dist
# - name: Wait for JupyterLab
# uses: ifaxity/wait-on-action@v1
# with:
# resource: http-get://localhost:8887/lab
# timeout: 180000
# - name: Install bokeh 3.0 compatibility packages
# run: |
# conda activate test-environment
# conda uninstall holoviews jupyter_bokeh --force -y --offline
# pip install "git+https://github.com/holoviz/[email protected]"
# pip install "git+https://github.com/bokeh/jupyter_bokeh.git"
# - name: doit env_capture
# run: |
# conda activate test-environment
# doit env_capture
# - name: doit test_ui
# run: |
# conda activate test-environment
# doit test_ui
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# files: ./coverage.xml
# flags: ui-tests
# fail_ci_if_error: false # optional (default = false)
2 changes: 1 addition & 1 deletion examples/apps/django/sliders/sinewave.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, **params):
super(SineWave, self).__init__(**params)
x, y = self.sine()
self.cds = ColumnDataSource(data=dict(x=x, y=y))
self.plot = figure(plot_height=400, plot_width=400,
self.plot = figure(height=400, width=400,
tools="crosshair,pan,reset,save,wheel_zoom",
x_range=self.x_range, y_range=self.y_range)
self.plot.line('x', 'y', source=self.cds, line_width=3, line_alpha=0.6)
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/django_multi_apps/sliders/pn_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, **params):
super(SineWave, self).__init__(**params)
x, y = self.sine()
self.cds = ColumnDataSource(data=dict(x=x, y=y))
self.plot = figure(plot_height=400, plot_width=400,
self.plot = figure(height=400, width=400,
tools="crosshair, pan, reset, save, wheel_zoom",
x_range=self.x_range, y_range=self.y_range)
self.plot.line('x', 'y', source=self.cds, line_width=3, line_alpha=0.6)
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/fastApi/sliders/sinewave.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, **params):
super(SineWave, self).__init__(**params)
x, y = self.sine()
self.cds = ColumnDataSource(data=dict(x=x, y=y))
self.plot = figure(plot_height=400, plot_width=400,
self.plot = figure(height=400, width=400,
tools="crosshair, pan, reset, save, wheel_zoom",
x_range=self.x_range, y_range=self.y_range)
self.plot.line('x', 'y', source=self.cds, line_width=3, line_alpha=0.6)
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/fastApi_multi_apps/sliders/sinewave.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, **params):
super(SineWave, self).__init__(**params)
x, y = self.sine()
self.cds = ColumnDataSource(data=dict(x=x, y=y))
self.plot = figure(plot_height=400, plot_width=400,
self.plot = figure(height=400, width=400,
tools="crosshair, pan, reset, save, wheel_zoom",
x_range=self.x_range, y_range=self.y_range)
self.plot.line('x', 'y', source=self.cds, line_width=3, line_alpha=0.6)
Expand Down
2 changes: 1 addition & 1 deletion examples/apps/fastApi_multi_apps/sliders2/sinewave.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, **params):
super(SineWave, self).__init__(**params)
x, y = self.sine()
self.cds = ColumnDataSource(data=dict(x=x, y=y))
self.plot = figure(plot_height=400, plot_width=400,
self.plot = figure(height=400, width=400,
tools="crosshair, pan, reset, save, wheel_zoom",
x_range=self.x_range, y_range=self.y_range)
self.plot.line('x', 'y', source=self.cds, line_width=3, line_alpha=0.6)
Expand Down
2 changes: 1 addition & 1 deletion examples/developer_guide/Developing_Custom_Models.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
"\n",
" static __module__ = \"panel.models.chartjs\"\n",
"\n",
" static init_ChartJS(): void {\n",
" static {\n",
" this.prototype.default_view = ChartJSView;\n",
"\n",
" this.define<ChartJS.Props>(({Int, String}) => ({\n",
Expand Down
10 changes: 4 additions & 6 deletions examples/gallery/links/bokeh_property_editor.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"outputs": [],
"source": [
"from bokeh.core.enums import LineDash, LineCap, MarkerType, NamedColor\n",
"from bokeh.core.property.vectorization import Value\n",
"from bokeh.models.plots import Model, _list_attr_splat"
]
},
Expand Down Expand Up @@ -73,14 +74,11 @@
"def get_widgets(model, skip_none=True, **kwargs):\n",
" widgets = []\n",
" for p, v in model.properties_with_values().items():\n",
" if isinstance(v, dict):\n",
" if 'value' in v:\n",
" v = v.get('value')\n",
" else:\n",
" continue\n",
" if isinstance(v, Value):\n",
" v = v.value\n",
" if v is None and skip_none:\n",
" continue\n",
" \n",
"\n",
" ps = dict(name=p, value=v, **kwargs)\n",
" if 'alpha' in p:\n",
" w = pn.widgets.FloatSlider(start=0, end=1, **ps)\n",
Expand Down
2 changes: 1 addition & 1 deletion examples/gallery/simple/iris_kmeans.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
" flowers['labels'] = est.labels_.astype('str')\n",
" centers = flowers.groupby('labels').mean()\n",
" return (flowers.sort_values('labels').hvplot.scatter(x, y, c='labels', size=100, height=500) *\n",
" centers.hvplot.scatter(x, y, marker='x', color='black', size=400,\n",
" centers.hvplot.scatter(x, y, marker='x', c='black', size=400,\n",
" padding=0.1, line_width=5))\n",
"\n",
"pn.Column(\n",
Expand Down
4 changes: 2 additions & 2 deletions examples/reference/panes/Alert.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"pn.Column(*[\n",
" pn.pane.Alert(text.format(alert_type=at), alert_type=at)\n",
" for at in pn.pane.Alert.param.alert_type.objects],\n",
" sizing_mode=\"stretch_width\",\n",
")"
" sizing_mode=\"stretch_width\"\n",
").servable()"
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/reference/panes/Bokeh.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"data['angle'] = data['value']/data['value'].sum() * 2*pi\n",
"data['color'] = Category20c[len(x)]\n",
"\n",
"p = figure(plot_height=350, title=\"Pie Chart\", toolbar_location=None,\n",
"p = figure(height=350, title=\"Pie Chart\", toolbar_location=None,\n",
" tools=\"hover\", tooltips=\"@country: @value\", x_range=(-0.5, 1.0))\n",
"\n",
"r = p.wedge(x=0, y=1, radius=0.4,\n",
Expand Down Expand Up @@ -134,7 +134,7 @@
"source = ColumnDataSource(data=dict(x=x, y=y))\n",
"\n",
"# Set up plot\n",
"plot = figure(plot_height=400, plot_width=400, title=\"my sine wave\",\n",
"plot = figure(height=400, width=400, title=\"my sine wave\",\n",
" tools=\"crosshair,pan,reset,save,wheel_zoom\",\n",
" x_range=[0, 4*np.pi], y_range=[-2.5, 2.5])\n",
"\n",
Expand Down
10 changes: 7 additions & 3 deletions examples/reference/panes/HTML.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
"metadata": {},
"outputs": [],
"source": [
"styles = {\n",
" 'background-color': '#F6F6F6', 'border': '2px solid black',\n",
" 'border-radius': '5px', 'padding': '10px'\n",
"}\n",
"\n",
"html_pane = pn.pane.HTML(\"\"\"\n",
"<h1>This is an HTML pane</h1>\n",
"\n",
Expand Down Expand Up @@ -70,8 +75,7 @@
" <td>94</td>\n",
" </tr>\n",
"</table>\n",
"\"\"\", style={'background-color': '#F6F6F6', 'border': '2px solid black',\n",
" 'border-radius': '5px', 'padding': '10px'})\n",
"\"\"\", styles=styles)\n",
"\n",
"html_pane"
]
Expand All @@ -89,7 +93,7 @@
"metadata": {},
"outputs": [],
"source": [
"html_pane.style = dict(html_pane.style, border='2px solid red')"
"html_pane.styles = dict(html_pane.styles, border='2px solid red')"
]
}
],
Expand Down
4 changes: 2 additions & 2 deletions examples/reference/panes/JPG.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"metadata": {},
"outputs": [],
"source": [
"jpg_pane = pn.pane.JPG('https://www.gstatic.com/webp/gallery/4.sm.jpg', width=500)\n",
"jpg_pane = pn.pane.JPG('https://www.gstatic.com/webp/gallery/4.sm.jpg')\n",
"\n",
"jpg_pane"
]
Expand Down Expand Up @@ -72,5 +72,5 @@
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
2 changes: 1 addition & 1 deletion examples/reference/panes/JSON.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
" 'string': 'A string',\n",
"}\n",
"\n",
"json = pn.pane.JSON(json_obj, name='JSON', height=300, width=500)\n",
"json = pn.pane.JSON(json_obj, name='JSON')\n",
"\n",
"json"
]
Expand Down
14 changes: 8 additions & 6 deletions examples/reference/panes/LaTeX.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@
"metadata": {},
"outputs": [],
"source": [
"latex = pn.pane.LaTeX(r'The LaTeX pane supports two delimiters: $LaTeX$ and \\(LaTeX\\)', \n",
" style={'font-size': '18pt'}, width=800)\n",
"latex = pn.pane.LaTeX(\n",
" r'The LaTeX pane supports two delimiters: $LaTeX$ and \\(LaTeX\\)', styles={'font-size': '18pt'}\n",
")\n",
"\n",
"latex"
]
},
Expand Down Expand Up @@ -94,7 +96,7 @@
"metadata": {},
"outputs": [],
"source": [
"pn.pane.LaTeX(r'$\\sum_{j}{\\sum_{i}{a*w_{j, i}}}$', renderer='mathjax', style={'font-size': '18pt'})"
"pn.pane.LaTeX(r'$\\sum_{j}{\\sum_{i}{a*w_{j, i}}}$', renderer='mathjax', styles={'font-size': '18pt'})"
]
},
{
Expand All @@ -117,19 +119,19 @@
" \\nabla \\times \\vec{\\mathbf{E}}\\, +\\, \\frac1c\\, \\frac{\\partial\\vec{\\mathbf{B}}}{\\partial t} & = \\vec{\\mathbf{0}} \\\\\n",
" \\nabla \\cdot \\vec{\\mathbf{B}} & = 0\n",
"\\end{aligned}\n",
"$\"\"\", style={'font-size': '24pt'})\n",
"$\"\"\", styles={'font-size': '24pt'})\n",
"\n",
"cauchy_schwarz = pn.pane.LaTeX(object=r\"\"\"\n",
"$\\left( \\sum_{k=1}^n a_k b_k \\right)^2 \\leq \\left( \\sum_{k=1}^n a_k^2 \\right) \\left( \\sum_{k=1}^n b_k^2 \\right)$\n",
"\"\"\", style={'font-size': '24pt'})\n",
"\"\"\", styles={'font-size': '24pt'})\n",
"\n",
"cross_product = pn.pane.LaTeX(object=r\"\"\"\n",
"$\\mathbf{V}_1 \\times \\mathbf{V}_2 = \\begin{vmatrix}\n",
"\\mathbf{i} & \\mathbf{j} & \\mathbf{k} \\\\\n",
"\\frac{\\partial X}{\\partial u} & \\frac{\\partial Y}{\\partial u} & 0 \\\\\n",
"\\frac{\\partial X}{\\partial v} & \\frac{\\partial Y}{\\partial v} & 0\n",
"\\end{vmatrix}\n",
"$\"\"\", style={'font-size': '24pt'})\n",
"$\"\"\", styles={'font-size': '24pt'})\n",
"\n",
"spacer = pn.Spacer(width=50)\n",
"\n",
Expand Down
Loading

0 comments on commit 72979ad

Please sign in to comment.