From 38ada79e7bf1a5b41a97faada2de2f783513792d Mon Sep 17 00:00:00 2001 From: Sergei Volkov Date: Tue, 24 Feb 2026 10:00:18 +0100 Subject: [PATCH 1/3] fix: pytest9 compatibility use pathlib.Path instead of deprecated py.path.local https://docs.pytest.org/en/stable/deprecations.html#fspath-argument-for-node-constructors-replaced-with-pathlib-path --- plotly/conftest.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plotly/conftest.py b/plotly/conftest.py index 1e1361dd518..bcea2a16be7 100644 --- a/plotly/conftest.py +++ b/plotly/conftest.py @@ -1,7 +1,8 @@ import os +from pathlib import Path -def pytest_ignore_collect(path): +def pytest_ignore_collect(collection_path: Path): # Ignored files, most of them are raising a chart studio error ignored_paths = [ "exploding_module.py", @@ -16,9 +17,10 @@ def pytest_ignore_collect(path): "presentation_objs.py", "session.py", ] + path_str = str(collection_path) if ( - os.path.basename(str(path)) in ignored_paths - or "plotly/plotly/plotly/__init__.py" in str(path) - or "plotly/api/utils.py" in str(path) + collection_path.name in ignored_paths + or "plotly/plotly/plotly/__init__.py" in path_str + or "plotly/api/utils.py" in path_str ): return True From c31ebe4c3ff821518146bd886159686937d4822b Mon Sep 17 00:00:00 2001 From: Sergei Volkov Date: Tue, 24 Feb 2026 10:03:42 +0100 Subject: [PATCH 2/3] fix numpy 2.0 compatibility: use method and isin instead of deprecated APIs Co-authored-by: Qwen-Coder --- plotly/figure_factory/_violin.py | 6 +++--- tests/test_optional/test_px/test_px.py | 2 +- tests/test_optional/test_px/test_px_functions.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plotly/figure_factory/_violin.py b/plotly/figure_factory/_violin.py index 55924e69238..285733fefd8 100644 --- a/plotly/figure_factory/_violin.py +++ b/plotly/figure_factory/_violin.py @@ -17,9 +17,9 @@ def calc_stats(data): x = np.asarray(data, float) vals_min = np.min(x) vals_max = np.max(x) - q2 = np.percentile(x, 50, interpolation="linear") - q1 = np.percentile(x, 25, interpolation="lower") - q3 = np.percentile(x, 75, interpolation="higher") + q2 = np.percentile(x, 50, method="linear") + q1 = np.percentile(x, 25, method="lower") + q3 = np.percentile(x, 75, method="higher") iqr = q3 - q1 whisker_dist = 1.5 * iqr diff --git a/tests/test_optional/test_px/test_px.py b/tests/test_optional/test_px/test_px.py index 6c65925a727..a74c4680540 100644 --- a/tests/test_optional/test_px/test_px.py +++ b/tests/test_optional/test_px/test_px.py @@ -36,7 +36,7 @@ def test_custom_data_scatter(backend): ) for data in fig.data: assert np.all( - np.in1d(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) + np.isin(data.customdata[:, 1], iris.get_column("petal_width").to_numpy()) ) # Hover and custom data, no repeated arguments fig = px.scatter( diff --git a/tests/test_optional/test_px/test_px_functions.py b/tests/test_optional/test_px/test_px_functions.py index 0814898f89d..8220ec7a33a 100644 --- a/tests/test_optional/test_px/test_px_functions.py +++ b/tests/test_optional/test_px/test_px_functions.py @@ -307,7 +307,7 @@ def test_sunburst_treemap_with_path_color(constructor): fig = px.sunburst( df.to_native(), path=path, color="sectors", color_discrete_map=cmap ) - assert np.all(np.in1d(fig.data[0].marker.colors, list(cmap.values()))) + assert np.all(np.isin(fig.data[0].marker.colors, list(cmap.values()))) # Numerical column in path df = ( From b8bbfffba35051ca871060ff32c6e4889447daf6 Mon Sep 17 00:00:00 2001 From: Sergei Volkov Date: Tue, 24 Feb 2026 10:09:56 +0100 Subject: [PATCH 3/3] add changelog entry for pytest 9 and numpy 2.0 fixes Co-authored-by: Qwen-Coder --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b0d878b358..bd230ac3e87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## Unreleased +### Fixed +- Fix pytest 9 compatibility: use `collection_path` instead of deprecated `path` argument in `pytest_ignore_collect` hook +- Fix NumPy 2.0 compatibility: use `method` instead of deprecated `interpolation` in `np.percentile` and `np.isin` instead of `np.in1d` + ## [6.5.2] - 2026-01-14 ### Fixed