Skip to content

Commit

Permalink
Merge branch 'main' into xarray_non_dimensional
Browse files Browse the repository at this point in the history
  • Loading branch information
hoxbro authored Feb 27, 2024
2 parents 4e7b3f7 + 9e5f904 commit a09b491
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 31 deletions.
13 changes: 9 additions & 4 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,17 @@ jobs:
with:
name: unit_test_suite
python-version: ${{ matrix.python-version }}
channel-priority: strict
channels: pyviz/label/dev,conda-forge,nodefaults
channel-priority: flexible
channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults
envs: "-o flakes -o tests -o examples_tests -o tests_ci"
cache: ${{ github.event.inputs.cache || github.event.inputs.cache == '' }}
conda-update: true
id: install
# - name: Check packages latest version
# if: needs.setup.outputs.code_change == 'true'
# run: |
# conda activate test-environment
# python scripts/check_latest_packages.py panel bokeh
- name: bokeh sampledata
if: needs.setup.outputs.code_change == 'true'
run: |
Expand Down Expand Up @@ -181,7 +186,7 @@ jobs:
with:
name: ui_test_suite
python-version: ${{ matrix.python-version }}
channels: pyviz/label/dev,bokeh,conda-forge,nodefaults
channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults
envs: "-o recommended -o tests -o build -o tests_ci"
cache: ${{ github.event.inputs.cache || github.event.inputs.cache == '' }}
playwright: true
Expand Down Expand Up @@ -249,7 +254,7 @@ jobs:
if: needs.setup.outputs.code_change == 'true'
run: |
# conda activate test-environment
python scripts/check_latest_packages.py
python scripts/check_latest_packages.py numpy pandas
- name: doit test_unit
if: needs.setup.outputs.code_change == 'true'
run: |
Expand Down
2 changes: 1 addition & 1 deletion holoviews/plotting/bokeh/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
from ...util.warnings import warn
from ..util import dim_axis_label

bokeh_version = Version(bokeh.__version__)
bokeh_version = Version(Version(bokeh.__version__).base_version)
bokeh32 = bokeh_version >= Version("3.2")
bokeh33 = bokeh_version >= Version("3.3")
bokeh34 = bokeh_version >= Version("3.4")
Expand Down
6 changes: 4 additions & 2 deletions holoviews/tests/plotting/bokeh/test_annotationplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
VSpan,
VSpans,
)
from holoviews.plotting.bokeh.util import bokeh32, bokeh33
from holoviews.plotting.bokeh.util import bokeh32, bokeh33, bokeh34

from .test_plot import TestBokehPlot, bokeh_renderer

Expand All @@ -29,7 +29,9 @@
VStrip as BkVStrip,
)

if bokeh33:
if bokeh34:
from bokeh.models import Node
elif bokeh33:
from bokeh.models.coordinates import Node


Expand Down
60 changes: 39 additions & 21 deletions holoviews/tests/ui/bokeh/test_callback.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import time

import numpy as np
import panel as pn
import pytest

import holoviews as hv
from holoviews import Curve, DynamicMap, Scatter
from holoviews.plotting.bokeh.util import bokeh34
from holoviews.streams import BoundsX, BoundsXY, BoundsY, Lasso, RangeXY

from .. import expect, wait_until
Expand Down Expand Up @@ -68,22 +67,41 @@ def test_lasso_select(serve_hv):
page.mouse.move(bbox['x']+50, bbox['y']+150, steps=5)
page.mouse.up()

time.sleep(1)

expected_array = np.array([
[ 3.28440367e-01, 2.31836735e+00],
[ 5.48623853e-01, 2.12244898e+00],
[ 6.58715596e-01, 2.02448980e+00],
[ 7.68807339e-01, 1.92653061e+00],
[ 8.78899083e-01, 1.82857143e+00],
[ 6.58715596e-01, 1.82857143e+00],
[ 4.38532110e-01, 1.82857143e+00],
[ 2.18348624e-01, 1.82857143e+00],
[-1.83486239e-03, 1.82857143e+00],
[-2.00000000e-01, 1.82857143e+00],
[-2.00000000e-01, 1.82857143e+00]
])
np.testing.assert_almost_equal(lasso.geometry, expected_array)
if bokeh34:
expected_array = np.array([
[3.28440367e-01, 2.31836735e00],
[4.38532110e-01, 2.22040816e00],
[5.48623853e-01, 2.12244898e00],
[6.58715596e-01, 2.02448980e00],
[7.68807339e-01, 1.92653061e00],
[8.78899083e-01, 1.82857143e00],
[6.58715596e-01, 1.82857143e00],
[4.38532110e-01, 1.82857143e00],
[2.18348624e-01, 1.82857143e00],
[-1.83486239e-03, 1.82857143e00],
[-2.00000000e-01, 1.82857143e00],
])
else:
expected_array = np.array([
[ 3.28440367e-01, 2.31836735e+00],
[ 5.48623853e-01, 2.12244898e+00],
[ 6.58715596e-01, 2.02448980e+00],
[ 7.68807339e-01, 1.92653061e+00],
[ 8.78899083e-01, 1.82857143e+00],
[ 6.58715596e-01, 1.82857143e+00],
[ 4.38532110e-01, 1.82857143e+00],
[ 2.18348624e-01, 1.82857143e+00],
[-1.83486239e-03, 1.82857143e+00],
[-2.00000000e-01, 1.82857143e+00],
[-2.00000000e-01, 1.82857143e+00]
])

def compare_array():
if lasso.geometry is None:
return False
np.testing.assert_almost_equal(lasso.geometry, expected_array)

wait_until(compare_array, page)

@pytest.mark.usefixtures("bokeh_backend")
def test_rangexy(serve_hv):
Expand Down Expand Up @@ -134,9 +152,9 @@ def test_multi_axis_rangexy(serve_hv):
expected_yrange1 = (717.2448979591848, 6657.244897959185)
expected_yrange2 = (-4232.7551020408155, 1707.2448979591848)
wait_until(lambda: (
s1.x_range == expected_xrange and
s1.y_range == expected_yrange1 and
s2.y_range == expected_yrange2
np.testing.assert_almost_equal(s1.x_range, expected_xrange) and
np.testing.assert_almost_equal(s1.y_range, expected_yrange1) and
np.testing.assert_almost_equal(s2.y_range, expected_yrange2)
), page)


Expand Down
7 changes: 5 additions & 2 deletions scripts/check_latest_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import requests
from packaging.version import Version

if sys.stdout.isatty():
GREEN, RED, RESET = "\033[92m", "\033[91m", "\033[0m"
else:
GREEN = RED = RESET = ""

def main(*packages):
allowed_date = date.today() - timedelta(days=5)
GREEN, RED, RESET = "\033[92m", "\033[91m", "\033[0m"
all_latest = True
for package in sorted(packages):
url = f"https://pypi.org/pypi/{package}/json"
Expand Down Expand Up @@ -38,4 +41,4 @@ def main(*packages):


if __name__ == "__main__":
main("numpy", "pandas")
main(*sys.argv[1:])
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
install_requires = [
"param >=1.12.0,<3.0",
"numpy >=1.0",
"pyviz_comms >=0.7.4",
"pyviz_comms >=2.1",
"panel >=1.0",
"colorcet",
"packaging",
Expand Down

0 comments on commit a09b491

Please sign in to comment.