diff --git a/CHANGELOG.md b/CHANGELOG.md index 4689455b..f4aa6ecb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Latest +## What's Changed +* :bug: `show_dash()` no longer fails with a `ValueError` on Windows when the working directory is on another drive than plotly-resampler (#362) by @raashish1601 + # v0.11.1 (2026-10-04) The README now points to [FlexViz](https://github.com/flex-analytics/flexviz), our successor project for whole-dashboard cross-filtering at scale. diff --git a/plotly_resampler/figure_resampler/figure_resampler.py b/plotly_resampler/figure_resampler/figure_resampler.py index 23f7d480..1346325d 100644 --- a/plotly_resampler/figure_resampler/figure_resampler.py +++ b/plotly_resampler/figure_resampler/figure_resampler.py @@ -10,7 +10,6 @@ __author__ = "Jonas Van Der Donckt, Jeroen Van Der Donckt, Emiel Deprost" -import os import warnings from pathlib import Path from typing import List, Optional, Tuple, Union @@ -568,7 +567,7 @@ def show_dash( if self._create_overview: # fmt: off # Add the assets folder to the init_dash_kwargs - init_dash_kwargs["assets_folder"] = os.path.relpath(ASSETS_FOLDER, os.getcwd()) + init_dash_kwargs["assets_folder"] = ASSETS_FOLDER # Also include the lodash script, as the client-side callbacks uses this init_dash_kwargs["external_scripts"] = ["https://cdn.jsdelivr.net/npm/lodash/lodash.min.js" ] # fmt: on diff --git a/tests/test_figure_resampler.py b/tests/test_figure_resampler.py index 983fd5f6..a0dbe6b7 100644 --- a/tests/test_figure_resampler.py +++ b/tests/test_figure_resampler.py @@ -1250,6 +1250,23 @@ def test_show_dash_graph_config_not_null(monkeypatch): assert all(isinstance(g["props"]["config"], dict) for g in graphs) +def test_show_dash_assets_folder_outside_cwd(monkeypatch, tmp_path): + # The assets folder must not depend on the cwd, which can be on another drive + # than plotly-resampler on Windows (see #362) + import dash + + from plotly_resampler import ASSETS_FOLDER + + monkeypatch.setattr(dash.Dash, "run", lambda *args, **kwargs: None) + monkeypatch.chdir(tmp_path) + fr = FigureResampler(go.Figure(), create_overview=True) + fr.add_trace(go.Scattergl(name="test"), hf_y=np.arange(10_000)) + fr.show_dash(mode="inline") + + assert fr._app.config.assets_folder == ASSETS_FOLDER + assert fr._app.server.test_client().get("/assets/coarse_fine.js").status_code == 200 + + def test_show_dash_default_mode(monkeypatch): import dash