From 9d0a6375c3a03a05110ab8a5c709250014fcff1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 10:49:03 +0100 Subject: [PATCH 01/35] Cast to datetime64[ns] --- holoviews/operation/datashader.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py index 2fbbb877c1..fc17686ae7 100644 --- a/holoviews/operation/datashader.py +++ b/holoviews/operation/datashader.py @@ -781,7 +781,7 @@ def _process(self, element, key=None): df['y0'] = np.array(0, df.dtypes[y.name]) yagg = ['y0', y.name] if xtype == 'datetime': - df[x.name] = cast_array_to_int64(df[x.name].astype('datetime64[us]')) + df[x.name] = cast_array_to_int64(df[x.name]) params = self._get_agg_params(element, x, y, agg_fn, (x0, y0, x1, y1)) @@ -820,13 +820,13 @@ def _process(self, element, key=None): (x_range, y_range), (xs, ys), (width, height), (xtype, ytype) = info ((x0, x1), (y0, y1)), (xs, ys) = self._dt_transform(x_range, y_range, xs, ys, xtype, ytype) - df = element.interface.as_dframe(element) + df = element.interface.as_dframe(element).copy() if xtype == 'datetime': - df[x0d.name] = cast_array_to_int64(df[x0d.name].astype('datetime64[us]')) - df[x1d.name] = cast_array_to_int64(df[x1d.name].astype('datetime64[us]')) + df[x0d.name] = cast_array_to_int64(df[x0d.name].astype('datetime64[ns]')) + df[x1d.name] = cast_array_to_int64(df[x1d.name].astype('datetime64[ns]')) if ytype == 'datetime': - df[y0d.name] = cast_array_to_int64(df[y0d.name].astype('datetime64[us]')) - df[y1d.name] = cast_array_to_int64(df[y1d.name].astype('datetime64[us]')) + df[y0d.name] = cast_array_to_int64(df[y0d.name].astype('datetime64[ns]')) + df[y1d.name] = cast_array_to_int64(df[y1d.name].astype('datetime64[ns]')) if isinstance(agg_fn, ds.count_cat) and df[agg_fn.column].dtype.name != 'category': df[agg_fn.column] = df[agg_fn.column].astype('category') From 28315f5bf3262414465c4e9a961cc8210d9911fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 10:49:50 +0100 Subject: [PATCH 02/35] Update test --- holoviews/tests/plotting/bokeh/test_callbacks.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/holoviews/tests/plotting/bokeh/test_callbacks.py b/holoviews/tests/plotting/bokeh/test_callbacks.py index 5b4c8df64c..e417832123 100644 --- a/holoviews/tests/plotting/bokeh/test_callbacks.py +++ b/holoviews/tests/plotting/bokeh/test_callbacks.py @@ -406,10 +406,9 @@ def test_cds_resolves(self): self.assertEqual(resolved, {'id': cds.ref['id'], 'value': points.columns()}) - @pytest.mark.filterwarnings("ignore::FutureWarning") def test_rangexy_datetime(self): # Raises a warning because makeTimeDataFrame isn't part of the public API. - curve = Curve(pd.util.testing.makeTimeDataFrame(), 'index', 'C') + curve = Curve(pd._testing.makeTimeDataFrame(), 'index', 'C') stream = RangeXY(source=curve) plot = bokeh_server_renderer.get_plot(curve) callback = plot.callbacks[0] From ea130127fe1dfaa0f67649f9ec397c3d65037b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 10:50:14 +0100 Subject: [PATCH 03/35] Add to github actions --- .github/workflows/test.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b47efcff2c..75a3d27455 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -37,10 +37,16 @@ jobs: # 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"]') }} bokeh-version: ['2', '3'] + pandas-version: ['1'] exclude: # Bokeh 3 does not support Python 3.7 - bokeh-version: '3' python-version: '3.7' + include: + - pandas-version: '2' + bokeh-version: '3' + python-version: '3.10' + os: 'ubuntu-latest' timeout-minutes: 120 # Because slow conda solve on Python 3.7 defaults: run: @@ -56,7 +62,7 @@ jobs: steps: - uses: pyviz-dev/holoviz_tasks/install@v0.1a9 with: - name: unit_test_suite_bokeh${{ matrix.bokeh-version }} + name: unit_test_suite_bokeh${{ matrix.bokeh-version }}_pandas${{ matrix.pandas-version }} python-version: ${{ matrix.python-version }} channel-priority: strict channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults @@ -65,6 +71,12 @@ jobs: conda-update: true conda-mamba: mamba id: install + - name: Pandas 2.0 install + if: steps.install.outputs.cache-hit != 'true' + run: | + conda activate test-environment + conda uninstall pandas --force --offline -y + mamba install pandas -c conda-forge/label/pandas_rc -y - name: bokeh sampledata run: | conda activate test-environment From 1b94895d8cd5e5506da3d2a219fb42b1136eaa40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 10:52:24 +0100 Subject: [PATCH 04/35] Add astype --- holoviews/operation/datashader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py index fc17686ae7..61b35e2890 100644 --- a/holoviews/operation/datashader.py +++ b/holoviews/operation/datashader.py @@ -781,7 +781,7 @@ def _process(self, element, key=None): df['y0'] = np.array(0, df.dtypes[y.name]) yagg = ['y0', y.name] if xtype == 'datetime': - df[x.name] = cast_array_to_int64(df[x.name]) + df[x.name] = cast_array_to_int64(df[x.name].astype('datetime64[ns]')) params = self._get_agg_params(element, x, y, agg_fn, (x0, y0, x1, y1)) From ddc9c7708ba8f30861bd58826bfc315b0e2f3d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 10:54:34 +0100 Subject: [PATCH 05/35] Add comment --- holoviews/tests/plotting/bokeh/test_callbacks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/holoviews/tests/plotting/bokeh/test_callbacks.py b/holoviews/tests/plotting/bokeh/test_callbacks.py index e417832123..b8f6d312dc 100644 --- a/holoviews/tests/plotting/bokeh/test_callbacks.py +++ b/holoviews/tests/plotting/bokeh/test_callbacks.py @@ -407,7 +407,6 @@ def test_cds_resolves(self): 'value': points.columns()}) def test_rangexy_datetime(self): - # Raises a warning because makeTimeDataFrame isn't part of the public API. curve = Curve(pd._testing.makeTimeDataFrame(), 'index', 'C') stream = RangeXY(source=curve) plot = bokeh_server_renderer.get_plot(curve) From ad5a8881d704f9ff3da06231fce4ef5f758463e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 11:41:42 +0100 Subject: [PATCH 06/35] Ignore not supported Dask test yet --- holoviews/tests/core/data/test_daskinterface.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/holoviews/tests/core/data/test_daskinterface.py b/holoviews/tests/core/data/test_daskinterface.py index 43ffa9c7e6..1cb048c455 100644 --- a/holoviews/tests/core/data/test_daskinterface.py +++ b/holoviews/tests/core/data/test_daskinterface.py @@ -1,7 +1,9 @@ from unittest import SkipTest +import unittest import numpy as np import pandas as pd +from packaging.version import Version try: import dask.dataframe as dd @@ -10,6 +12,7 @@ from holoviews.core.data import Dataset from holoviews.util.transform import dim +from holoviews.core.util import pandas_version from .test_pandasinterface import BasePandasInterfaceTests @@ -73,6 +76,20 @@ def test_dataset_2D_partial_reduce_ht(self): def test_dataset_aggregate_string_types(self): raise SkipTest("Temporarily skipped") + @unittest.skipIf( + pandas_version >= Version("2.0rc0"), + reason="Not supported yet, https://github.com/dask/dask/issues/9913" + ) + def test_dataset_aggregate_ht(self): + super().test_dataset_aggregate_ht() + + @unittest.skipIf( + pandas_version >= Version("2.0rc0"), + reason="Not supported yet, https://github.com/dask/dask/issues/9913" + ) + def test_dataset_aggregate_ht_alias(self): + super().test_dataset_aggregate_ht_alias() + def test_dataset_from_multi_index(self): raise SkipTest("Temporarily skipped") df = pd.DataFrame({'x': np.arange(10), 'y': np.arange(10), 'z': np.random.rand(10)}) From 1cd269246a000f7cb811422ff6d8fb9aee6667b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 12:00:01 +0100 Subject: [PATCH 07/35] Update ci --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 75a3d27455..1756707906 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -27,7 +27,7 @@ jobs: - name: pre-commit uses: pre-commit/action@v3.0.0 test_suite: - name: Pytest on ${{ matrix.python-version }}, Bokeh ${{ matrix.bokeh-version }}, ${{ matrix.os }} + name: Pytest on ${{ matrix.python-version }}, Bokeh ${{ matrix.bokeh-version }}, Pandas ${{ matrix.pandas-version }}, ${{ matrix.os }} needs: [pre_commit] runs-on: ${{ matrix.os }} strategy: @@ -52,7 +52,7 @@ jobs: run: shell: bash -el {0} env: - DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }} tests" + DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }} - Pandas ${{ matrix.pandas-version }} tests" PYTHON_VERSION: ${{ matrix.python-version }} SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" DISPLAY: ":99.0" @@ -72,7 +72,7 @@ jobs: conda-mamba: mamba id: install - name: Pandas 2.0 install - if: steps.install.outputs.cache-hit != 'true' + if: steps.install.outputs.cache-hit != 'true' && ${{ matrix.pandas-version }} == '2' run: | conda activate test-environment conda uninstall pandas --force --offline -y From 5ba1915ae5baeac35349d21c61b94b228ef50268 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 12:18:15 +0100 Subject: [PATCH 08/35] Test --- .github/workflows/test.yaml | 5 +++-- setup.cfg | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 1756707906..c2f3db3714 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -72,11 +72,12 @@ jobs: conda-mamba: mamba id: install - name: Pandas 2.0 install - if: steps.install.outputs.cache-hit != 'true' && ${{ matrix.pandas-version }} == '2' + if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '2' run: | conda activate test-environment - conda uninstall pandas --force --offline -y + conda uninstall pandas dask dask-core --force --offline -y mamba install pandas -c conda-forge/label/pandas_rc -y + mamba install dask-core -y - name: bokeh sampledata run: | conda activate test-environment diff --git a/setup.cfg b/setup.cfg index 4746d97602..66394da342 100644 --- a/setup.cfg +++ b/setup.cfg @@ -6,3 +6,4 @@ namespace_map = ibis-framework=ibis-sqlite ; dask pins to bokeh<3 right now dask=dask-core + geoviews=geoviews-core From 4477f31f7d105bc1017382d2950cb01248eebf08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 14:10:51 +0100 Subject: [PATCH 09/35] Update examples with keyword argument --- examples/gallery/demos/bokeh/bars_economic.ipynb | 2 +- examples/gallery/demos/bokeh/dropdown_economic.ipynb | 2 +- examples/gallery/demos/bokeh/us_unemployment.ipynb | 2 +- examples/gallery/demos/matplotlib/bars_economic.ipynb | 2 +- examples/gallery/demos/matplotlib/dropdown_economic.ipynb | 2 +- examples/gallery/demos/matplotlib/us_unemployment.ipynb | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/gallery/demos/bokeh/bars_economic.ipynb b/examples/gallery/demos/bokeh/bars_economic.ipynb index a43aad952f..4c08fefe11 100644 --- a/examples/gallery/demos/bokeh/bars_economic.ipynb +++ b/examples/gallery/demos/bokeh/bars_economic.ipynb @@ -34,7 +34,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", diff --git a/examples/gallery/demos/bokeh/dropdown_economic.ipynb b/examples/gallery/demos/bokeh/dropdown_economic.ipynb index 8821af71b7..2e06b50352 100644 --- a/examples/gallery/demos/bokeh/dropdown_economic.ipynb +++ b/examples/gallery/demos/bokeh/dropdown_economic.ipynb @@ -34,7 +34,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", diff --git a/examples/gallery/demos/bokeh/us_unemployment.ipynb b/examples/gallery/demos/bokeh/us_unemployment.ipynb index e7e0f2908d..8c76682bf5 100644 --- a/examples/gallery/demos/bokeh/us_unemployment.ipynb +++ b/examples/gallery/demos/bokeh/us_unemployment.ipynb @@ -39,7 +39,7 @@ "source": [ "from bokeh.sampledata.unemployment1948 import data\n", "\n", - "data = pd.melt(data.drop('Annual', 1), id_vars='Year', var_name='Month', value_name='Unemployment')\n", + "data = pd.melt(data.drop('Annual', axis=1), id_vars='Year', var_name='Month', value_name='Unemployment')\n", "heatmap = hv.HeatMap(data, label=\"US Unemployment (1948 - 2013)\")" ] }, diff --git a/examples/gallery/demos/matplotlib/bars_economic.ipynb b/examples/gallery/demos/matplotlib/bars_economic.ipynb index 6b7e4ffe57..ee63b7b118 100644 --- a/examples/gallery/demos/matplotlib/bars_economic.ipynb +++ b/examples/gallery/demos/matplotlib/bars_economic.ipynb @@ -35,7 +35,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", diff --git a/examples/gallery/demos/matplotlib/dropdown_economic.ipynb b/examples/gallery/demos/matplotlib/dropdown_economic.ipynb index 1878977033..aa61a38e79 100644 --- a/examples/gallery/demos/matplotlib/dropdown_economic.ipynb +++ b/examples/gallery/demos/matplotlib/dropdown_economic.ipynb @@ -35,7 +35,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", diff --git a/examples/gallery/demos/matplotlib/us_unemployment.ipynb b/examples/gallery/demos/matplotlib/us_unemployment.ipynb index f23669815e..1722631b6b 100644 --- a/examples/gallery/demos/matplotlib/us_unemployment.ipynb +++ b/examples/gallery/demos/matplotlib/us_unemployment.ipynb @@ -39,7 +39,7 @@ "\n", "colors = [\"#75968f\", \"#a5bab7\", \"#c9d9d3\", \"#e2e2e2\", \"#dfccce\", \"#ddb7b1\", \"#cc7878\", \"#933b41\", \"#550b1d\"]\n", "\n", - "data = pd.melt(data.drop('Annual', 1), id_vars='Year', var_name='Month', value_name='Unemployment')\n", + "data = pd.melt(data.drop('Annual', axis=1), id_vars='Year', var_name='Month', value_name='Unemployment')\n", "\n", "heatmap = hv.HeatMap(data, label=\"US Unemployment (1948 - 2013)\")" ] From 0f2b1d7769130e327d5298884a7f2cf0eb5ca2f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 14:42:28 +0100 Subject: [PATCH 10/35] Fix connect_tri_edges_pd --- holoviews/element/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holoviews/element/util.py b/holoviews/element/util.py index 88eac1e2db..bc961c9750 100644 --- a/holoviews/element/util.py +++ b/holoviews/element/util.py @@ -294,7 +294,7 @@ def connect_tri_edges_pd(trimesh): edges = edges.drop("color", errors="ignore", axis=1).reset_index() nodes = trimesh.nodes.dframe().copy() nodes.index.name = 'node_index' - nodes = nodes.drop("color", errors="ignore", axis=1) + nodes = nodes.drop(["color", "z"], errors="ignore", axis=1) v1, v2, v3 = trimesh.kdims x, y, idx = trimesh.nodes.kdims[:3] From 22fa6f82ce202c7c262c2faa243ca96b0c80c0f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 14 Mar 2023 15:21:40 +0100 Subject: [PATCH 11/35] Add rest of keywords arguments --- examples/gallery/demos/bokeh/scatter_economic.ipynb | 2 +- examples/gallery/demos/matplotlib/scatter_economic.ipynb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/gallery/demos/bokeh/scatter_economic.ipynb b/examples/gallery/demos/bokeh/scatter_economic.ipynb index 1020cc23e9..ccc43b4618 100644 --- a/examples/gallery/demos/bokeh/scatter_economic.ipynb +++ b/examples/gallery/demos/bokeh/scatter_economic.ipynb @@ -34,7 +34,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", diff --git a/examples/gallery/demos/matplotlib/scatter_economic.ipynb b/examples/gallery/demos/matplotlib/scatter_economic.ipynb index bc888cb69d..28ace828d0 100644 --- a/examples/gallery/demos/matplotlib/scatter_economic.ipynb +++ b/examples/gallery/demos/matplotlib/scatter_economic.ipynb @@ -36,7 +36,7 @@ "metadata": {}, "outputs": [], "source": [ - "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', '\\t')\n", + "macro_df = pd.read_csv('http://assets.holoviews.org/macro.csv', delimiter='\\t')\n", "key_dimensions = [('year', 'Year'), ('country', 'Country')]\n", "value_dimensions = [('unem', 'Unemployment'), ('capmob', 'Capital Mobility'),\n", " ('gdp', 'GDP Growth'), ('trade', 'Trade')]\n", From 189a115244adfa0074f60708bec71931b6c9a7a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 4 Apr 2023 10:53:00 +0200 Subject: [PATCH 12/35] Always convert to datetime64[ns] --- holoviews/operation/datashader.py | 32 +++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py index 61b35e2890..ddb4581f6b 100644 --- a/holoviews/operation/datashader.py +++ b/holoviews/operation/datashader.py @@ -222,11 +222,11 @@ def _get_sampling(self, element, x, y, ndim=2, default=None): def _dt_transform(self, x_range, y_range, xs, ys, xtype, ytype): (xstart, xend), (ystart, yend) = x_range, y_range if xtype == 'datetime': - xstart, xend = (np.array([xstart, xend])/1e3).astype('datetime64[us]') - xs = (xs/1e3).astype('datetime64[us]') + xstart, xend = np.array([xstart, xend]).astype('datetime64[ns]') + xs = xs.astype('datetime64[ns]') if ytype == 'datetime': - ystart, yend = (np.array([ystart, yend])/1e3).astype('datetime64[us]') - ys = (ys/1e3).astype('datetime64[us]') + ystart, yend = np.array([ystart, yend]).astype('datetime64[ns]') + ys = ys.astype('datetime64[ns]') return ((xstart, xend), (ystart, yend)), (xs, ys) @@ -528,9 +528,9 @@ def _process(self, element, key=None): if 'x_axis' in agg.coords and 'y_axis' in agg.coords: agg = agg.rename({'x_axis': x, 'y_axis': y}) if xtype == 'datetime': - agg[x.name] = (agg[x.name]/1e3).astype('datetime64[us]') + agg[x.name] = agg[x.name].astype('datetime64[ns]') if ytype == 'datetime': - agg[y.name] = (agg[y.name]/1e3).astype('datetime64[us]') + agg[y.name] = agg[y.name].astype('datetime64[ns]') if agg.ndim == 2: # Replacing x and y coordinates to avoid numerical precision issues @@ -700,7 +700,7 @@ def _process(self, element, key=None): agg = cvs.area(df, x.name, y.name, agg_fn, axis=0, y_stack=ystack) if xtype == "datetime": - agg[x.name] = (agg[x.name]/1e3).astype('datetime64[us]') + agg[x.name] = agg[x.name].astype('datetime64[ns]') return self.p.element_type(agg, **params) @@ -797,7 +797,7 @@ def _process(self, element, key=None): agg = cvs.line(df, x.name, yagg, agg_fn, axis=1, **agg_kwargs).rename(rename_dict) if xtype == "datetime": - agg[x.name] = (agg[x.name]/1e3).astype('datetime64[us]') + agg[x.name] = agg[x.name].astype('datetime64[ns]') return self.p.element_type(agg, **params) @@ -843,9 +843,9 @@ def _process(self, element, key=None): xdim, ydim = list(agg.dims)[:2][::-1] if xtype == "datetime": - agg[xdim] = (agg[xdim]/1e3).astype('datetime64[us]') + agg[xdim] = agg[xdim].astype('datetime64[ns]') if ytype == "datetime": - agg[ydim] = (agg[ydim]/1e3).astype('datetime64[us]') + agg[ydim] = agg[ydim].astype('datetime64[ns]') params['kdims'] = [xdim, ydim] @@ -1017,9 +1017,9 @@ def _process(self, element, key=None): # Convert datetime coordinates if xtype == "datetime": - rarray[x.name] = (rarray[x.name]/1e3).astype('datetime64[us]') + rarray[x.name] = rarray[x.name].astype('datetime64[ns]') if ytype == "datetime": - rarray[y.name] = (rarray[y.name]/1e3).astype('datetime64[us]') + rarray[y.name] = rarray[y.name].astype('datetime64[ns]') regridded[vd] = rarray regridded = xr.Dataset(regridded) @@ -1197,9 +1197,9 @@ def _process(self, element, key=None): info = self._get_sampling(element, x, y) (x_range, y_range), (xs, ys), (width, height), (xtype, ytype) = info if xtype == 'datetime': - data[x.name] = data[x.name].astype('datetime64[us]').astype('int64') + data[x.name] = data[x.name].astype('datetime64[ns]').astype('int64') if ytype == 'datetime': - data[y.name] = data[y.name].astype('datetime64[us]').astype('int64') + data[y.name] = data[y.name].astype('datetime64[ns]').astype('int64') # Compute bounds (converting datetimes) ((x0, x1), (y0, y1)), (xs, ys) = self._dt_transform( @@ -1218,9 +1218,9 @@ def _process(self, element, key=None): agg = cvs.quadmesh(data[vdim], x.name, y.name, agg_fn) xdim, ydim = list(agg.dims)[:2][::-1] if xtype == "datetime": - agg[xdim] = (agg[xdim]/1e3).astype('datetime64[us]') + agg[xdim] = agg[xdim].astype('datetime64[ns]') if ytype == "datetime": - agg[ydim] = (agg[ydim]/1e3).astype('datetime64[us]') + agg[ydim] = agg[ydim].astype('datetime64[ns]') return Image(agg, **params) From 78a9001ac419058c8168fc6c8ce8782709bdff80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 4 Apr 2023 10:53:24 +0200 Subject: [PATCH 13/35] Update test.yaml --- .github/workflows/test.yaml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7a15893f0f..64349daad0 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,15 +41,15 @@ jobs: # 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"]') }} bokeh-version: ['2', '3'] - pandas-version: ['1'] + pandas-version: ['2'] exclude: # Bokeh 3 does not support Python 3.7 - bokeh-version: '3' python-version: '3.7' include: - - pandas-version: '2' + - pandas-version: '1' bokeh-version: '3' - python-version: '3.10' + python-version: '3.8' os: 'ubuntu-latest' timeout-minutes: 120 # Because slow conda solve on Python 3.7 defaults: @@ -75,13 +75,11 @@ jobs: conda-update: true conda-mamba: mamba id: install - - name: Pandas 2.0 install - if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '2' + - name: Pandas 1.5 install + if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '1' run: | conda activate test-environment - conda uninstall pandas dask dask-core --force --offline -y - mamba install pandas -c conda-forge/label/pandas_rc -y - mamba install dask-core -y + mamba install pandas=1.5 -y - name: bokeh sampledata run: | conda activate test-environment From 5498e5fa2c0d87015675b0bd2feb570de15d6034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 4 Apr 2023 10:53:46 +0200 Subject: [PATCH 14/35] Force dt_to_int to return int --- holoviews/core/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/holoviews/core/util.py b/holoviews/core/util.py index ebf5241992..c58cfb0904 100644 --- a/holoviews/core/util.py +++ b/holoviews/core/util.py @@ -2108,7 +2108,7 @@ def dt_to_int(value, time_unit='us'): try: value = np.datetime64(value, 'ns') tscale = (np.timedelta64(1, time_unit)/np.timedelta64(1, 'ns')) - return value.tolist()/tscale + return int(value.tolist() / tscale) except Exception: # If it can't handle ns precision fall back to datetime value = value.tolist() From 30b0788f76b66395fea2cea5ef62c9b9a6f234b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 4 Apr 2023 10:54:35 +0200 Subject: [PATCH 15/35] Only copy if xtype/ytype is datetime --- holoviews/operation/datashader.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/holoviews/operation/datashader.py b/holoviews/operation/datashader.py index ddb4581f6b..6e044f9950 100644 --- a/holoviews/operation/datashader.py +++ b/holoviews/operation/datashader.py @@ -820,7 +820,9 @@ def _process(self, element, key=None): (x_range, y_range), (xs, ys), (width, height), (xtype, ytype) = info ((x0, x1), (y0, y1)), (xs, ys) = self._dt_transform(x_range, y_range, xs, ys, xtype, ytype) - df = element.interface.as_dframe(element).copy() + df = element.interface.as_dframe(element) + if xtype == 'datetime' or ytype == 'datetime': + df = df.copy() if xtype == 'datetime': df[x0d.name] = cast_array_to_int64(df[x0d.name].astype('datetime64[ns]')) df[x1d.name] = cast_array_to_int64(df[x1d.name].astype('datetime64[ns]')) From c35c11248833e2572e671dcaa0518d42fbeb68ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Tue, 4 Apr 2023 11:15:12 +0200 Subject: [PATCH 16/35] Add spatialpandas to bokeh2 only test --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d30977e6c3..594a1fc7ea 100644 --- a/setup.py +++ b/setup.py @@ -64,7 +64,6 @@ # Packages not working on python 3.11 because of numba if sys.version_info < (3, 11): extras_require['tests'] += [ - 'spatialpandas', 'datashader >=0.11.1', ] @@ -141,6 +140,11 @@ extras_require['bokeh2'] = ["panel <1.0.0a1"] extras_require['bokeh3'] = ["panel >=1.0.0a1"] +# Packages not working on python 3.11 because of numba and +# not working on bokeh 3 because of dask +if sys.version_info < (3, 11): + extras_require['bokeh2'].append("spatialpandas") + extras_require["build"] = [ "param >=1.7.0", "setuptools >=30.3.0", From f3c800d50e0bc14de273cfffed53225b9221d682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 6 Apr 2023 08:44:13 +0200 Subject: [PATCH 17/35] Add fix for np.intc pandas --- holoviews/core/data/pandas.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/holoviews/core/data/pandas.py b/holoviews/core/data/pandas.py index da5cf4403d..a2082271f0 100644 --- a/holoviews/core/data/pandas.py +++ b/holoviews/core/data/pandas.py @@ -12,6 +12,11 @@ from .. import util from .util import finite_range +if Version(pd.__version__) == Version("2.0.0"): + # https://github.com/pandas-dev/pandas/issues/52451 + from pandas._libs import hashtable + pd.core.reshape.merge._factorizers[np.intc] = hashtable.Int32Factorizer + class PandasAPI: """ From a819fa4bb6636dddc077e5a18ef4702b719a65c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 6 Apr 2023 09:36:59 +0200 Subject: [PATCH 18/35] Workaround xarray not supporting pandas 2.0 yet --- .github/workflows/test.yaml | 14 +++++++------- setup.py | 1 + 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 64349daad0..fe79619587 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,16 +41,15 @@ jobs: # 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"]') }} bokeh-version: ['2', '3'] - pandas-version: ['2'] + pandas-version: ['1'] exclude: # Bokeh 3 does not support Python 3.7 - bokeh-version: '3' python-version: '3.7' include: - - pandas-version: '1' + - pandas-version: '2' bokeh-version: '3' - python-version: '3.8' - os: 'ubuntu-latest' + python-version: '3.10' timeout-minutes: 120 # Because slow conda solve on Python 3.7 defaults: run: @@ -75,11 +74,12 @@ jobs: conda-update: true conda-mamba: mamba id: install - - name: Pandas 1.5 install - if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '1' + - name: Pandas 2 install + if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '2' run: | conda activate test-environment - mamba install pandas=1.5 -y + conda uninstall pandas dask dask-core xarray --force --offline -y + mamba install pandas dask-core -y - name: bokeh sampledata run: | conda activate test-environment diff --git a/setup.py b/setup.py index 594a1fc7ea..81edd09465 100644 --- a/setup.py +++ b/setup.py @@ -59,6 +59,7 @@ 'scipy', 'selenium', 'numpy <1.24', # Upper pin because of numba error + 'pandas <2.0', # xarray does not support pandas 2.0 yet: https://github.com/pydata/xarray/issues/7716 ] # Packages not working on python 3.11 because of numba From 55ec5dd9d8a5c524fed7258752d8e6d59067a1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 08:14:09 +0200 Subject: [PATCH 19/35] Remove rc for unittest --- holoviews/tests/core/data/test_daskinterface.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/holoviews/tests/core/data/test_daskinterface.py b/holoviews/tests/core/data/test_daskinterface.py index 1cb048c455..cf20f94ca3 100644 --- a/holoviews/tests/core/data/test_daskinterface.py +++ b/holoviews/tests/core/data/test_daskinterface.py @@ -77,14 +77,14 @@ def test_dataset_aggregate_string_types(self): raise SkipTest("Temporarily skipped") @unittest.skipIf( - pandas_version >= Version("2.0rc0"), + pandas_version >= Version("2.0"), reason="Not supported yet, https://github.com/dask/dask/issues/9913" ) def test_dataset_aggregate_ht(self): super().test_dataset_aggregate_ht() @unittest.skipIf( - pandas_version >= Version("2.0rc0"), + pandas_version >= Version("2.0"), reason="Not supported yet, https://github.com/dask/dask/issues/9913" ) def test_dataset_aggregate_ht_alias(self): From 131b90b07a2d2d57039e2d9e26224afc883e19f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 08:18:43 +0200 Subject: [PATCH 20/35] Add os to test.yaml --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fe79619587..9c16552a7b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,6 +50,7 @@ jobs: - pandas-version: '2' bokeh-version: '3' python-version: '3.10' + os: 'ubuntu-latest' timeout-minutes: 120 # Because slow conda solve on Python 3.7 defaults: run: From 3f94aaad0aa18bdec3016ed302389f340e43780f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 08:21:48 +0200 Subject: [PATCH 21/35] Add rest of os --- .github/workflows/test.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9c16552a7b..6c754ac4a7 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -51,6 +51,14 @@ jobs: bokeh-version: '3' python-version: '3.10' os: 'ubuntu-latest' + - pandas-version: '2' + bokeh-version: '3' + python-version: '3.10' + os: 'windows-latest' + - pandas-version: '2' + bokeh-version: '3' + python-version: '3.10' + os: 'macos-latest' timeout-minutes: 120 # Because slow conda solve on Python 3.7 defaults: run: From 287680e7c17bb9c8b422a07ff4384400d19a0e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 12:39:11 +0200 Subject: [PATCH 22/35] Don't run examples on pandas=2.0 because of xarray incompatibility --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 6c754ac4a7..d1c4d90c1f 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -98,7 +98,7 @@ jobs: conda activate test-environment doit test_unit - name: test examples - if: matrix.python-version != '3.11' + if: matrix.python-version != '3.11' && matrix.pandas-version != '2' run: | conda activate test-environment mkdir -p ~/.jupyter/ From a8968984ff06a5cf60985b19dfff51fb17cd31c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 14:34:58 +0200 Subject: [PATCH 23/35] Add ignore_glob to file --- examples/conftest.py | 19 +++++++++++++++++++ holoviews/core/data/pandas.py | 5 ----- tox.ini | 5 +---- 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 examples/conftest.py diff --git a/examples/conftest.py b/examples/conftest.py new file mode 100644 index 0000000000..116081e2b7 --- /dev/null +++ b/examples/conftest.py @@ -0,0 +1,19 @@ +import pandas as pd +from packaging.version import Version + +collect_ignore_glob = [ + "Plotting_with_Bokeh", # needs selenium, phantomjs, firefox, and geckodriver to save a png picture. + "17-Dashboards", # can give a timeout error. + "Plots_and_Renderers", # give file not found here. +] + +# Add sys.version for numba +# if sys.version_info == (3, 11): + +if Version(pd.__version__) >= Version("2.0"): + collect_ignore_glob += [ + # Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 + "user_guide", + # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 + "reference/elements/*/TriMesh.ipynb", + ] diff --git a/holoviews/core/data/pandas.py b/holoviews/core/data/pandas.py index a2082271f0..da5cf4403d 100644 --- a/holoviews/core/data/pandas.py +++ b/holoviews/core/data/pandas.py @@ -12,11 +12,6 @@ from .. import util from .util import finite_range -if Version(pd.__version__) == Version("2.0.0"): - # https://github.com/pandas-dev/pandas/issues/52451 - from pandas._libs import hashtable - pd.core.reshape.merge._factorizers[np.intc] = hashtable.Int32Factorizer - class PandasAPI: """ diff --git a/tox.ini b/tox.ini index fb7f03c2a1..a4e2590583 100644 --- a/tox.ini +++ b/tox.ini @@ -28,10 +28,7 @@ commands = pytest holoviews --cov=./holoviews -vv [_examples] description = Test that default examples run deps = .[examples_tests] -commands = pytest -n auto --dist loadscope --nbval-lax examples --force-flaky --max-runs=5 -k "not Plotting_with_Bokeh and not 17-Dashboards and not Plots_and_Renderers" -# 'Plotting_with_Bokeh' needs selenium, phantomjs, firefox and geckodriver to save a png picture. -# '17-Dashboards' can give a timeout error. -# 'Plots_and_Renderers' can give file not found here. +commands = pytest -n auto --dist loadscope --nbval-lax examples --force-flaky --max-runs=5 [_all_recommended] description = Run all recommended tests From f17f33e20f4c28a9d32d60871ed0709e55c43135 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 14:41:04 +0200 Subject: [PATCH 24/35] Remove version 3.11 safe guard for examples --- .github/workflows/test.yaml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d1c4d90c1f..614fb174bb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -98,20 +98,11 @@ jobs: conda activate test-environment doit test_unit - name: test examples - if: matrix.python-version != '3.11' && matrix.pandas-version != '2' run: | conda activate test-environment mkdir -p ~/.jupyter/ echo "c.ExecutePreprocessor.startup_timeout=600" >> ~/.jupyter/jupyter_nbconvert_config.py doit test_examples - - name: test examples - python 3.11 - # Should be removed when numba support python 3.11 - if: matrix.python-version == '3.11' - run: | - conda activate test-environment - mkdir -p ~/.jupyter/ - echo "c.ExecutePreprocessor.startup_timeout=600" >> ~/.jupyter/jupyter_nbconvert_config.py - pytest -n auto --dist loadscope --nbval-lax examples/reference/elements - name: codecov run: | conda activate test-environment From 3ae33855c3bef66ddae74be23927e337de4d70e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 16:01:22 +0200 Subject: [PATCH 25/35] Add more notebooks to ignore --- examples/conftest.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/examples/conftest.py b/examples/conftest.py index 116081e2b7..eca2d743a5 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -1,3 +1,5 @@ +import sys + import pandas as pd from packaging.version import Version @@ -8,7 +10,15 @@ ] # Add sys.version for numba -# if sys.version_info == (3, 11): +if sys.version_info == (3, 11): + collect_ignore_glob += [ + # numba not supported on Python 3.11 + "15-Large_Data", + "16-Streaming_Data", + "17-Dashboards", + "Network_Graphs", + "Linked_Brushing", + ] if Version(pd.__version__) >= Version("2.0"): collect_ignore_glob += [ @@ -16,4 +26,5 @@ "user_guide", # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 "reference/elements/*/TriMesh.ipynb", + "point_draw_triangulate", ] From 77ed9afec8a6f5d35e46194d761120b311e0d8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 17:09:57 +0200 Subject: [PATCH 26/35] Better path in conftest --- examples/conftest.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/examples/conftest.py b/examples/conftest.py index eca2d743a5..a6ebd0c9cd 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -4,27 +4,28 @@ from packaging.version import Version collect_ignore_glob = [ - "Plotting_with_Bokeh", # needs selenium, phantomjs, firefox, and geckodriver to save a png picture. - "17-Dashboards", # can give a timeout error. - "Plots_and_Renderers", # give file not found here. + # Needs selenium, phantomjs, firefox, and geckodriver to save a png picture + "user_guide/Plotting_with_Bokeh.ipynb", + # Possible timeout error + "user_guide/17-Dashboards.ipynb", + # Give file not found here. + "user_guide/Plots_and_Renderers.ipynb", ] -# Add sys.version for numba -if sys.version_info == (3, 11): +if sys.version_info[:2] == (3, 11): collect_ignore_glob += [ # numba not supported on Python 3.11 - "15-Large_Data", - "16-Streaming_Data", - "17-Dashboards", - "Network_Graphs", - "Linked_Brushing", + "user_guide/15-Large_Data.ipynb", + "user_guide/16-Streaming_Data.ipynb", + "user_guide/Network_Graphs.ipynb", + "user_guide/Linked_Brushing.ipynb", ] if Version(pd.__version__) >= Version("2.0"): collect_ignore_glob += [ # Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 - "user_guide", + # "user_guide", # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 "reference/elements/*/TriMesh.ipynb", - "point_draw_triangulate", + "gallery/demos/bokeh/point_draw_triangulate.ipynb", ] From 3d5bfe640f21424f3bcb923109052ea26c190d11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 17:58:39 +0200 Subject: [PATCH 27/35] Ignore xarray examples for pandas 2 --- examples/conftest.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/examples/conftest.py b/examples/conftest.py index a6ebd0c9cd..b8c711ab2b 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -3,18 +3,19 @@ import pandas as pd from packaging.version import Version + collect_ignore_glob = [ # Needs selenium, phantomjs, firefox, and geckodriver to save a png picture "user_guide/Plotting_with_Bokeh.ipynb", # Possible timeout error "user_guide/17-Dashboards.ipynb", - # Give file not found here. + # Give file not found "user_guide/Plots_and_Renderers.ipynb", ] -if sys.version_info[:2] == (3, 11): +if sys.version_info >= (3, 11): collect_ignore_glob += [ - # numba not supported on Python 3.11 + # Numba is released on Python 3.11 "user_guide/15-Large_Data.ipynb", "user_guide/16-Streaming_Data.ipynb", "user_guide/Network_Graphs.ipynb", @@ -24,7 +25,12 @@ if Version(pd.__version__) >= Version("2.0"): collect_ignore_glob += [ # Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 - # "user_guide", + "user_guide/09-Gridded_Datasets.ipynb", + "user_guide/11-Transforming_Elements.ipynb", + "user_guide/15-Large_Data.ipynb", + "user_guide/16-Streaming_Data.ipynb", + "user_guide/Network_Graphs.ipynb", + "user_guide/Linked_Brushing.ipynb", # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 "reference/elements/*/TriMesh.ipynb", "gallery/demos/bokeh/point_draw_triangulate.ipynb", From c4551134a6e33596efcb2b9eac0ca575b27554c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Sat, 8 Apr 2023 18:40:03 +0200 Subject: [PATCH 28/35] Only ignore pandas bug on windows --- examples/conftest.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/examples/conftest.py b/examples/conftest.py index b8c711ab2b..811307f7c0 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -3,6 +3,7 @@ import pandas as pd from packaging.version import Version +PD2 = Version(pd.__version__) >= Version("2.0") collect_ignore_glob = [ # Needs selenium, phantomjs, firefox, and geckodriver to save a png picture @@ -13,25 +14,29 @@ "user_guide/Plots_and_Renderers.ipynb", ] +# Numba incompatibility if sys.version_info >= (3, 11): collect_ignore_glob += [ - # Numba is released on Python 3.11 "user_guide/15-Large_Data.ipynb", "user_guide/16-Streaming_Data.ipynb", - "user_guide/Network_Graphs.ipynb", "user_guide/Linked_Brushing.ipynb", + "user_guide/Network_Graphs.ipynb", ] -if Version(pd.__version__) >= Version("2.0"): +# Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 +if PD2: collect_ignore_glob += [ - # Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 "user_guide/09-Gridded_Datasets.ipynb", "user_guide/11-Transforming_Elements.ipynb", "user_guide/15-Large_Data.ipynb", "user_guide/16-Streaming_Data.ipynb", - "user_guide/Network_Graphs.ipynb", "user_guide/Linked_Brushing.ipynb", - # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 - "reference/elements/*/TriMesh.ipynb", + "user_guide/Network_Graphs.ipynb", + ] + +# Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 +if PD2 and sys.platform == "win32": + collect_ignore_glob += [ "gallery/demos/bokeh/point_draw_triangulate.ipynb", + "reference/elements/*/TriMesh.ipynb", ] From 801dd8fd5ecb6399a4470a8fe49a3a76ddc0b070 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 14:20:19 +0200 Subject: [PATCH 29/35] Try again with pandas two as default --- .github/workflows/test.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 614fb174bb..36e044bc52 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,21 +41,21 @@ jobs: # 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"]') }} bokeh-version: ['2', '3'] - pandas-version: ['1'] + pandas-version: ['2'] exclude: # Bokeh 3 does not support Python 3.7 - bokeh-version: '3' python-version: '3.7' include: - - pandas-version: '2' + - pandas-version: '1' bokeh-version: '3' python-version: '3.10' os: 'ubuntu-latest' - - pandas-version: '2' + - pandas-version: '1' bokeh-version: '3' python-version: '3.10' os: 'windows-latest' - - pandas-version: '2' + - pandas-version: '1' bokeh-version: '3' python-version: '3.10' os: 'macos-latest' @@ -83,12 +83,12 @@ jobs: conda-update: true conda-mamba: mamba id: install - - name: Pandas 2 install - if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '2' + - name: Pandas 1 install + if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '1' run: | conda activate test-environment - conda uninstall pandas dask dask-core xarray --force --offline -y - mamba install pandas dask-core -y + conda uninstall pandas --force --offline -y + mamba install "pandas<2" -y - name: bokeh sampledata run: | conda activate test-environment From e7fb2070d1006ae20cc3e34a374e48fa343673cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 14:45:17 +0200 Subject: [PATCH 30/35] Remove pandas pin --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 81edd09465..594a1fc7ea 100644 --- a/setup.py +++ b/setup.py @@ -59,7 +59,6 @@ 'scipy', 'selenium', 'numpy <1.24', # Upper pin because of numba error - 'pandas <2.0', # xarray does not support pandas 2.0 yet: https://github.com/pydata/xarray/issues/7716 ] # Packages not working on python 3.11 because of numba From c0c0c22289b04d60d912886caeaeec31972f8558 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 17:07:24 +0200 Subject: [PATCH 31/35] Remove Bokeh dev channel --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 36e044bc52..be166f17d8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -77,7 +77,7 @@ jobs: name: unit_test_suite_bokeh${{ matrix.bokeh-version }}_pandas${{ matrix.pandas-version }} python-version: ${{ matrix.python-version }} channel-priority: strict - channels: pyviz/label/dev,bokeh/label/dev,conda-forge,nodefaults + channels: pyviz/label/dev,conda-forge,nodefaults envs: "-o flakes -o tests -o examples_tests -o bokeh${{ matrix.bokeh-version }}" cache: true conda-update: true From 165eae809e014f7129266a4c155951797e80da9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 17:21:37 +0200 Subject: [PATCH 32/35] Remove pandas 1 from CI --- .github/workflows/test.yaml | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index be166f17d8..b20c611566 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,30 +41,16 @@ jobs: # 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"]') }} bokeh-version: ['2', '3'] - pandas-version: ['2'] exclude: # Bokeh 3 does not support Python 3.7 - bokeh-version: '3' python-version: '3.7' - include: - - pandas-version: '1' - bokeh-version: '3' - python-version: '3.10' - os: 'ubuntu-latest' - - pandas-version: '1' - bokeh-version: '3' - python-version: '3.10' - os: 'windows-latest' - - pandas-version: '1' - bokeh-version: '3' - python-version: '3.10' - os: 'macos-latest' - timeout-minutes: 120 # Because slow conda solve on Python 3.7 + timeout-minutes: 120 defaults: run: shell: bash -el {0} env: - DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }} - Pandas ${{ matrix.pandas-version }} tests" + DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }}" PYTHON_VERSION: ${{ matrix.python-version }} SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" DISPLAY: ":99.0" @@ -83,12 +69,6 @@ jobs: conda-update: true conda-mamba: mamba id: install - - name: Pandas 1 install - if: steps.install.outputs.cache-hit != 'true' && matrix.pandas-version == '1' - run: | - conda activate test-environment - conda uninstall pandas --force --offline -y - mamba install "pandas<2" -y - name: bokeh sampledata run: | conda activate test-environment From af9e5975c7e5ef93e19e733c6d98b673fe1d1273 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 17:26:22 +0200 Subject: [PATCH 33/35] Add back xarray examples to CI --- examples/conftest.py | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/examples/conftest.py b/examples/conftest.py index 811307f7c0..5b21d9cafe 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -23,17 +23,6 @@ "user_guide/Network_Graphs.ipynb", ] -# Xarray incompatibility: https://github.com/pydata/xarray/issues/7716 -if PD2: - collect_ignore_glob += [ - "user_guide/09-Gridded_Datasets.ipynb", - "user_guide/11-Transforming_Elements.ipynb", - "user_guide/15-Large_Data.ipynb", - "user_guide/16-Streaming_Data.ipynb", - "user_guide/Linked_Brushing.ipynb", - "user_guide/Network_Graphs.ipynb", - ] - # Pandas bug: https://github.com/pandas-dev/pandas/issues/52451 if PD2 and sys.platform == "win32": collect_ignore_glob += [ From b3012d3a7ce8e26e9cba5bfaf617750062dd6336 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Wed, 19 Apr 2023 21:53:42 +0200 Subject: [PATCH 34/35] Add 15-Large_Data to Pandas2-windows ignore --- examples/conftest.py | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/conftest.py b/examples/conftest.py index 5b21d9cafe..6f5f7b355d 100644 --- a/examples/conftest.py +++ b/examples/conftest.py @@ -28,4 +28,5 @@ collect_ignore_glob += [ "gallery/demos/bokeh/point_draw_triangulate.ipynb", "reference/elements/*/TriMesh.ipynb", + "user_guide/15-Large_Data.ipynb", ] From d2ec7641486c3ed3961b3fb17c8a738f4ffa43b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20H=C3=B8xbro=20Hansen?= Date: Thu, 20 Apr 2023 09:15:05 +0200 Subject: [PATCH 35/35] Clean up --- .github/workflows/test.yaml | 6 +++--- setup.py | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b20c611566..6a1777e1f6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -31,7 +31,7 @@ jobs: - name: pre-commit uses: pre-commit/action@v3.0.0 test_suite: - name: Pytest on ${{ matrix.python-version }}, Bokeh ${{ matrix.bokeh-version }}, Pandas ${{ matrix.pandas-version }}, ${{ matrix.os }} + name: Pytest on ${{ matrix.python-version }}, Bokeh ${{ matrix.bokeh-version }}, ${{ matrix.os }} needs: [pre_commit] runs-on: ${{ matrix.os }} strategy: @@ -50,7 +50,7 @@ jobs: run: shell: bash -el {0} env: - DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }}" + DESC: "Python ${{ matrix.python-version }} - Bokeh ${{ matrix.bokeh-version }} tests" PYTHON_VERSION: ${{ matrix.python-version }} SETUPTOOLS_ENABLE_FEATURES: "legacy-editable" DISPLAY: ":99.0" @@ -60,7 +60,7 @@ jobs: steps: - uses: pyviz-dev/holoviz_tasks/install@v0.1a9 with: - name: unit_test_suite_bokeh${{ matrix.bokeh-version }}_pandas${{ matrix.pandas-version }} + name: unit_test_suite_bokeh${{ matrix.bokeh-version }} python-version: ${{ matrix.python-version }} channel-priority: strict channels: pyviz/label/dev,conda-forge,nodefaults diff --git a/setup.py b/setup.py index 26e04201b9..a2d8b8d6a0 100644 --- a/setup.py +++ b/setup.py @@ -64,6 +64,7 @@ # Packages not working on python 3.11 because of numba if sys.version_info < (3, 11): extras_require['tests'] += [ + 'spatialpandas', 'datashader >=0.11.1', ] @@ -140,11 +141,6 @@ extras_require['bokeh2'] = ["panel <1.0.0a1"] extras_require['bokeh3'] = ["panel >=1.0.0a1"] -# Packages not working on python 3.11 because of numba and -# not working on bokeh 3 because of dask -if sys.version_info < (3, 11): - extras_require['bokeh2'].append("spatialpandas") - extras_require["build"] = [ "param >=1.7.0", "setuptools >=30.3.0",