Skip to content

Commit 87c744f

Browse files
committed
compat: Stop direct dependency on pandas itself
1 parent c89baf6 commit 87c744f

19 files changed

+246
-122
lines changed

.github/workflows/test.yaml

Lines changed: 100 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ jobs:
133133

134134
unit_test_suite:
135135
name: unit:${{ matrix.environment }}:${{ matrix.os }}
136-
needs: [pre_commit, setup, pixi_lock]
136+
needs: [setup, pixi_lock]
137+
# needs: [pre_commit, setup, pixi_lock] # HACK: Should be added back
137138
runs-on: ${{ matrix.os }}
138139
if: needs.setup.outputs.code_change == 'true'
139140
strategy:
@@ -145,6 +146,11 @@ jobs:
145146
with:
146147
environments: ${{ matrix.environment }}
147148
opengl: true
149+
- name: PATCH # HACK: Should never be merged into main
150+
run: |
151+
pixi run -e ${{ matrix.environment }} bash scripts/no_pandas_import.sh
152+
pixi run -e ${{ matrix.environment }} pip install git+https://github.com/holoviz/holoviews@improve_nopandas
153+
pixi run -e ${{ matrix.environment }} pip uninstall pandas -y
148154
- name: Test unit
149155
run: |
150156
pixi run -e ${{ matrix.environment }} test-unit $COV
@@ -162,78 +168,78 @@ jobs:
162168
with:
163169
token: ${{ secrets.CODECOV_TOKEN }}
164170

165-
ui_test_suite:
166-
name: ui:${{ matrix.environment }}:${{ matrix.os }}
167-
needs: [pre_commit, setup, pixi_lock]
168-
runs-on: ${{ matrix.os }}
169-
if: needs.setup.outputs.code_change == 'true' || needs.setup.outputs.doc_change == 'true'
170-
strategy:
171-
fail-fast: false
172-
matrix:
173-
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
174-
environment: ["test-ui"]
175-
timeout-minutes: 60
176-
env:
177-
PANEL_LOG_LEVEL: info
178-
OAUTH_COOKIE_SECRET: ${{ secrets.OAUTH_COOKIE_SECRET }}
179-
OAUTH_ENCRYPTION_KEY: ${{ secrets.OAUTH_ENCRYPTION_KEY }}
180-
AUTH0_PORT: "5701"
181-
AUTH0_OAUTH_KEY: ${{ secrets.AUTH0_OAUTH_KEY }}
182-
AUTH0_OAUTH_SECRET: ${{ secrets.AUTH0_OAUTH_SECRET }}
183-
AUTH0_OAUTH_EXTRA_PARAMS: ${{ secrets.AUTH0_OAUTH_EXTRA_PARAMS }}
184-
AUTH0_OAUTH_USER: ${{ secrets.AUTH0_OAUTH_USER }}
185-
AUTH0_OAUTH_PASSWORD: ${{ secrets.AUTH0_OAUTH_PASSWORD }}
186-
OKTA_PORT: "5703"
187-
OKTA_OAUTH_KEY: ${{ secrets.OKTA_OAUTH_KEY }}
188-
OKTA_OAUTH_SECRET: ${{ secrets.OKTA_OAUTH_SECRET }}
189-
OKTA_OAUTH_EXTRA_PARAMS: ${{ secrets.OKTA_OAUTH_EXTRA_PARAMS }}
190-
OKTA_OAUTH_USER: ${{ secrets.OKTA_OAUTH_USER }}
191-
OKTA_OAUTH_PASSWORD: ${{ secrets.OKTA_OAUTH_PASSWORD }}
192-
steps:
193-
- uses: holoviz-dev/holoviz_tasks/pixi_install@v0
194-
with:
195-
environments: ${{ matrix.environment }}
196-
id: install
197-
- name: Build pyodide wheels
198-
run: pixi run -e test-ui "python ./scripts/build_pyodide_wheels.py"
199-
- name: Launch JupyterLab
200-
shell: pixi run -e test-ui bash -e {0}
201-
run: |
202-
jupyter server extension enable panel.io.jupyter_server_extension --sys-prefix
203-
(jupyter lab --config panel/tests/ui/jupyter_server_test_config.py --port 8887 > /tmp/jupyterlab_server.log 2>&1) &
204-
- name: Build JupyterLite
205-
shell: pixi run -e test-ui bash -e {0}
206-
run: pixi run -e lite lite-build
207-
- name: Wait for JupyterLab
208-
uses: ifaxity/[email protected]
209-
with:
210-
resource: http-get://localhost:8887/lab
211-
timeout: 180000
212-
- name: Check if auth should run
213-
if: '!github.event.pull_request.head.repo.fork'
214-
run: |
215-
echo "PANEL_TEST_AUTH=1" >> $GITHUB_ENV
216-
- name: Test UI
217-
run: |
218-
# Create a .uicoveragerc file to set the concurrency library to greenlet
219-
# https://github.com/microsoft/playwright-python/issues/313
220-
echo "[run]\nconcurrency = greenlet" > .uicoveragerc
221-
FAIL="--screenshot only-on-failure --full-page-screenshot --output ui_screenshots --tracing retain-on-failure"
222-
pixi run -e ${{ matrix.environment }} test-ui --jupyter $COV --cov-config=.uicoveragerc $FAIL
223-
- uses: actions/upload-artifact@v4
224-
if: always()
225-
with:
226-
name: ui_screenshots_${{ runner.os }}
227-
path: ./ui_screenshots
228-
if-no-files-found: ignore
229-
- name: Stop JupyterLab
230-
if: always()
231-
shell: pixi run -e test-ui bash -e {0}
232-
run: |
233-
jupyter lab stop 8887 || true
234-
- uses: codecov/codecov-action@v4
235-
with:
236-
token: ${{ secrets.CODECOV_TOKEN }}
171+
# ui_test_suite:
172+
# name: ui:${{ matrix.environment }}:${{ matrix.os }}
173+
# needs: [pre_commit, setup, pixi_lock]
174+
# runs-on: ${{ matrix.os }}
175+
# if: needs.setup.outputs.code_change == 'true' || needs.setup.outputs.doc_change == 'true'
176+
# strategy:
177+
# fail-fast: false
178+
# matrix:
179+
# os: ["ubuntu-latest", "macos-latest", "windows-latest"]
180+
# environment: ["test-ui"]
181+
# timeout-minutes: 60
182+
# env:
183+
# PANEL_LOG_LEVEL: info
184+
# OAUTH_COOKIE_SECRET: ${{ secrets.OAUTH_COOKIE_SECRET }}
185+
# OAUTH_ENCRYPTION_KEY: ${{ secrets.OAUTH_ENCRYPTION_KEY }}
186+
# AUTH0_PORT: "5701"
187+
# AUTH0_OAUTH_KEY: ${{ secrets.AUTH0_OAUTH_KEY }}
188+
# AUTH0_OAUTH_SECRET: ${{ secrets.AUTH0_OAUTH_SECRET }}
189+
# AUTH0_OAUTH_EXTRA_PARAMS: ${{ secrets.AUTH0_OAUTH_EXTRA_PARAMS }}
190+
# AUTH0_OAUTH_USER: ${{ secrets.AUTH0_OAUTH_USER }}
191+
# AUTH0_OAUTH_PASSWORD: ${{ secrets.AUTH0_OAUTH_PASSWORD }}
192+
# OKTA_PORT: "5703"
193+
# OKTA_OAUTH_KEY: ${{ secrets.OKTA_OAUTH_KEY }}
194+
# OKTA_OAUTH_SECRET: ${{ secrets.OKTA_OAUTH_SECRET }}
195+
# OKTA_OAUTH_EXTRA_PARAMS: ${{ secrets.OKTA_OAUTH_EXTRA_PARAMS }}
196+
# OKTA_OAUTH_USER: ${{ secrets.OKTA_OAUTH_USER }}
197+
# OKTA_OAUTH_PASSWORD: ${{ secrets.OKTA_OAUTH_PASSWORD }}
198+
# steps:
199+
# - uses: holoviz-dev/holoviz_tasks/pixi_install@v0
200+
# with:
201+
# environments: ${{ matrix.environment }}
202+
# id: install
203+
# - name: Build pyodide wheels
204+
# run: pixi run -e test-ui "python ./scripts/build_pyodide_wheels.py"
205+
# - name: Launch JupyterLab
206+
# shell: pixi run -e test-ui bash -e {0}
207+
# run: |
208+
# jupyter server extension enable panel.io.jupyter_server_extension --sys-prefix
209+
# (jupyter lab --config panel/tests/ui/jupyter_server_test_config.py --port 8887 > /tmp/jupyterlab_server.log 2>&1) &
210+
# - name: Build JupyterLite
211+
# shell: pixi run -e test-ui bash -e {0}
212+
# run: pixi run -e lite lite-build
213+
# - name: Wait for JupyterLab
214+
# uses: ifaxity/[email protected]
215+
# with:
216+
# resource: http-get://localhost:8887/lab
217+
# timeout: 180000
218+
# - name: Check if auth should run
219+
# if: '!github.event.pull_request.head.repo.fork'
220+
# run: |
221+
# echo "PANEL_TEST_AUTH=1" >> $GITHUB_ENV
222+
# - name: Test UI
223+
# run: |
224+
# # Create a .uicoveragerc file to set the concurrency library to greenlet
225+
# # https://github.com/microsoft/playwright-python/issues/313
226+
# echo "[run]\nconcurrency = greenlet" > .uicoveragerc
227+
# FAIL="--screenshot only-on-failure --full-page-screenshot --output ui_screenshots --tracing retain-on-failure"
228+
# pixi run -e ${{ matrix.environment }} test-ui --jupyter $COV --cov-config=.uicoveragerc $FAIL
229+
# - uses: actions/upload-artifact@v4
230+
# if: always()
231+
# with:
232+
# name: ui_screenshots_${{ runner.os }}
233+
# path: ./ui_screenshots
234+
# if-no-files-found: ignore
235+
# - name: Stop JupyterLab
236+
# if: always()
237+
# shell: pixi run -e test-ui bash -e {0}
238+
# run: |
239+
# jupyter lab stop 8887 || true
240+
# - uses: codecov/codecov-action@v4
241+
# with:
242+
# token: ${{ secrets.CODECOV_TOKEN }}
237243

238244
core_test_suite:
239245
name: core:${{ matrix.environment }}:${{ matrix.os }}
@@ -254,29 +260,30 @@ jobs:
254260
run: |
255261
pixi run -e ${{ matrix.environment }} test-unit
256262
257-
type_test_suite:
258-
name: type:${{ matrix.environment }}:${{ matrix.os }}
259-
needs: [pre_commit, setup, pixi_lock]
260-
runs-on: ${{ matrix.os }}
261-
if: needs.setup.outputs.code_change == 'true'
262-
strategy:
263-
fail-fast: false
264-
matrix:
265-
os: ["ubuntu-latest"]
266-
environment: ["test-type"]
267-
timeout-minutes: 30
268-
steps:
269-
- uses: holoviz-dev/holoviz_tasks/pixi_install@v0
270-
with:
271-
environments: ${{ matrix.environment }}
272-
install: false
273-
- name: Test Type
274-
run: |
275-
pixi run -e ${{ matrix.environment }} test-type
263+
# type_test_suite:
264+
# name: type:${{ matrix.environment }}:${{ matrix.os }}
265+
# needs: [pre_commit, setup, pixi_lock]
266+
# runs-on: ${{ matrix.os }}
267+
# if: needs.setup.outputs.code_change == 'true'
268+
# strategy:
269+
# fail-fast: false
270+
# matrix:
271+
# os: ["ubuntu-latest"]
272+
# environment: ["test-type"]
273+
# timeout-minutes: 30
274+
# steps:
275+
# - uses: holoviz-dev/holoviz_tasks/pixi_install@v0
276+
# with:
277+
# environments: ${{ matrix.environment }}
278+
# install: false
279+
# - name: Test Type
280+
# run: |
281+
# pixi run -e ${{ matrix.environment }} test-type
276282

277283
result_test_suite:
278284
name: result:test
279-
needs: [unit_test_suite, ui_test_suite, core_test_suite, type_test_suite]
285+
needs: [unit_test_suite, core_test_suite]
286+
# needs: [unit_test_suite, ui_test_suite, core_test_suite, type_test_suite] # HACK: ADD BACK
280287
if: always()
281288
runs-on: ubuntu-latest
282289
steps:

panel/tests/chat/test_message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from io import BytesIO
66
from zoneinfo import ZoneInfo
77

8-
import pandas as pd
8+
# import pandas as pd
99
import pytest
1010

1111
from panel import Param, bind

panel/tests/conftest.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from functools import cache
1919
from subprocess import PIPE, Popen
2020

21-
import pandas as pd
2221
import pytest
2322

2423
from bokeh.client import pull_session
@@ -272,6 +271,7 @@ def port():
272271

273272
@pytest.fixture
274273
def dataframe():
274+
import pandas as pd
275275
return pd.DataFrame({
276276
'int': [1, 2, 3],
277277
'float': [3.14, 6.28, 9.42],
@@ -281,6 +281,7 @@ def dataframe():
281281

282282
@pytest.fixture
283283
def df_mixed():
284+
import pandas as pd
284285
df = pd.DataFrame({
285286
'int': [1, 2, 3, 4],
286287
'float': [3.14, 6.28, 9.42, -2.45],
@@ -294,6 +295,7 @@ def df_mixed():
294295

295296
@pytest.fixture
296297
def df_multiindex(df_mixed):
298+
import pandas as pd
297299
df_mi = df_mixed.copy()
298300
df_mi.index = pd.MultiIndex.from_tuples([
299301
('group0', 'subgroup0'),
@@ -573,6 +575,7 @@ def eh(exception):
573575

574576
@pytest.fixture
575577
def df_strings():
578+
import pandas as pd
576579
descr = [
577580
'Under the Weather',
578581
'Top Drawer',

panel/tests/io/test_cache.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from collections import Counter
77

88
import numpy as np
9-
import pandas as pd
9+
# import pandas as pd
1010
import param
1111
import pytest
1212
import requests
@@ -383,19 +383,19 @@ def expensive_calculation(self, value):
383383

384384
assert model.executions == 2
385385

386-
DF1 = pd.DataFrame({"x": [1]})
387-
DF2 = pd.DataFrame({"y": [1]})
386+
# DF1 = pd.DataFrame({"x": [1]})
387+
# DF2 = pd.DataFrame({"y": [1]})
388388

389-
def test_hash_on_simple_dataframes():
390-
assert _generate_hash(DF1)!=_generate_hash(DF2)
389+
# def test_hash_on_simple_dataframes():
390+
# assert _generate_hash(DF1)!=_generate_hash(DF2)
391391

392392
@pytest.mark.parametrize(["value", "other", "expected"], [
393393
(None, None, True),
394394
(True, False, False), (False, True, False), (False, False, True), (True, True, True),
395395
(None, 1, False), (1, None, False), (1, 1, True), (1,2,False),
396396
(None, "a", False), ("a", None, False), ("a", "a", True), ("a","b",False),
397397
(1,"1", False),
398-
(None, DF1, False), (DF1, None, False), (DF1, DF1, True), (DF1, DF1.copy(), True), (DF1,DF2,False),
398+
# (None, DF1, False), (DF1, None, False), (DF1, DF1, True), (DF1, DF1.copy(), True), (DF1,DF2,False),
399399
])
400400
def test_is_equal(value, other, expected):
401401
assert is_equal(value, other)==expected

panel/tests/io/test_location.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import pandas as pd
1+
# import pandas as pd
22
import param
33
import pytest
44

@@ -27,7 +27,7 @@ class SyncParameterized(param.Parameterized):
2727

2828
string = param.String(default=None)
2929

30-
dataframe = param.DataFrame(default=None)
30+
# dataframe = param.DataFrame(default=None)
3131

3232

3333
def test_location_update_query(location):
@@ -170,7 +170,8 @@ def test_iframe_srcdoc_location():
170170

171171
@pytest.fixture
172172
def dataframe():
173-
return pd.DataFrame({"x": [1]})
173+
return None
174+
# return pd.DataFrame({"x": [1]})
174175

175176
def test_location_sync_from_dataframe(location, dataframe):
176177
p = SyncParameterized(dataframe=dataframe)

panel/tests/pane/test_markup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from unittest.mock import patch
88

99
import numpy as np
10-
import pandas as pd
10+
# import pandas as pd
1111
import pytest
1212

1313
from panel import config

panel/tests/pane/test_plotly.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
plotly_available = pytest.mark.skipif(plotly is None, reason="requires plotly")
1717

1818
import numpy as np
19-
import pandas as pd
19+
# import pandas as pd
2020

2121
from panel.models.plotly import PlotlyPlot
2222
from panel.pane import PaneBase, Plotly

panel/tests/pane/test_vega.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
altair_available = pytest.mark.skipif(alt is None, reason="requires altair")
1414

1515
import numpy as np
16-
import pandas as pd
16+
# import pandas as pd
1717

1818
import panel as pn
1919

@@ -46,7 +46,7 @@
4646
'mark': {'tooltip': None},
4747
'view': {'height': 300, 'width': 400}
4848
},
49-
'data': {'values': pd.DataFrame({'x': ['A', 'B', 'C', 'D', 'E'], 'y': [5, 3, 6, 7, 2]})},
49+
'data': {'values': {'x': ['A', 'B', 'C', 'D', 'E'], 'y': [5, 3, 6, 7, 2]}},
5050
'mark': 'bar',
5151
'encoding': {'x': {'type': 'ordinal', 'field': 'x'},
5252
'y': {'type': 'quantitative', 'field': 'y'}},

panel/tests/test_custom.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
import pandas as pd
2+
# import pandas as pd
33
import param
44

55
from panel.custom import PyComponent, ReactiveESM
@@ -46,9 +46,9 @@ def test_py_component_cleanup(document, comm):
4646
assert not spy._view__._models
4747

4848

49-
class ESMDataFrame(ReactiveESM):
50-
51-
df = param.DataFrame(doc="""A DataFrame to be displayed in the ESM.""")
49+
# class ESMDataFrame(ReactiveESM):
50+
#
51+
# df = param.DataFrame(default=None, doc="""A DataFrame to be displayed in the ESM.""")
5252

5353

5454
def test_reactive_esm_sync_dataframe(document, comm):

panel/tests/test_expression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
import pandas as pd
2+
# import pandas as pd
33
import param
44

55
from param import rx

0 commit comments

Comments
 (0)