From 8c084900fefb7d82db4dbc99973c5b23b4da6c1e Mon Sep 17 00:00:00 2001 From: jernejfrank Date: Mon, 17 Aug 2026 11:14:28 +0100 Subject: [PATCH] Fix failing plotly CI --- .github/workflows/hamilton-main.yml | 1 - hamilton/plugins/plotly_extensions.py | 2 +- pyproject.toml | 4 ++-- tests/conftest.py | 2 -- tests/plugins/test_plotly_extensions.py | 8 ++++++++ 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/hamilton-main.yml b/.github/workflows/hamilton-main.yml index 987e94a2d..aecae09b0 100644 --- a/.github/workflows/hamilton-main.yml +++ b/.github/workflows/hamilton-main.yml @@ -85,7 +85,6 @@ jobs: - name: Test hamilton main package run: | uv sync --group test - uv pip install "kaleido<0.4.0" uv run pytest tests/ --cov=hamilton --ignore tests/integrations diff --git a/hamilton/plugins/plotly_extensions.py b/hamilton/plugins/plotly_extensions.py index 5ff74747a..c1090e940 100644 --- a/hamilton/plugins/plotly_extensions.py +++ b/hamilton/plugins/plotly_extensions.py @@ -42,7 +42,7 @@ class PlotlyStaticWriter(DataSaver): height: int | None = None scale: int | float | None = None validate: bool = True - engine: str = "auto" + engine: str | None = None def _get_saving_kwargs(self) -> dict: kwargs = {} diff --git a/pyproject.toml b/pyproject.toml index 74ad5d586..457da5e5e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -108,7 +108,7 @@ test = [ "dlt", "fsspec", "graphviz", - "kaleido; python_version < '3.14'", + "kaleido", "kedro; python_version < '3.14'", "lancedb; python_version < '3.14'", "lightgbm; python_version < '3.14'", @@ -119,7 +119,7 @@ test = [ "networkx", "openpyxl", # for excel data loader "pandera[dask]", - "plotly; python_version < '3.14'", + "plotly", "polars; python_version < '3.14'", "pyarrow", "pydantic >=2.0", diff --git a/tests/conftest.py b/tests/conftest.py index 8842bb39d..1d52afb5f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -26,8 +26,6 @@ "plugins/test_polars_extensions.py", "plugins/test_polars_lazyframe_extensions.py", "resources/narwhals_example.py", - # plotly - no Python 3.14 support yet - "plugins/test_plotly_extensions.py", # xgboost - no Python 3.14 support yet "plugins/test_xgboost_extensions.py", # lightgbm - no Python 3.14 support yet diff --git a/tests/plugins/test_plotly_extensions.py b/tests/plugins/test_plotly_extensions.py index a2a0e48b8..ce064eca5 100644 --- a/tests/plugins/test_plotly_extensions.py +++ b/tests/plugins/test_plotly_extensions.py @@ -38,12 +38,20 @@ def test_plotly_static_writer(figure: go.Figure, tmp_path: pathlib.Path) -> None file_path = tmp_path / "figure.png" writer = PlotlyStaticWriter(path=file_path) + assert "engine" not in writer._get_saving_kwargs() + metadata = writer.save_data(figure) assert file_path.exists() assert metadata[FILE_METADATA]["path"] == str(file_path) +def test_plotly_static_writer_preserves_explicit_engine(tmp_path: pathlib.Path) -> None: + writer = PlotlyStaticWriter(path=tmp_path / "figure.png", engine="kaleido") + + assert writer._get_saving_kwargs()["engine"] == "kaleido" + + def test_plotly_interactive_writer(figure: go.Figure, tmp_path: pathlib.Path) -> None: file_path = tmp_path / "figure.html"