Skip to content

chore(deps): adopt kaleido 1.4 for docs and tutorials - #1092

Open
Blizzeq wants to merge 2 commits into
OpenSTEF:mainfrom
Blizzeq:chore/adopt-kaleido-1.4
Open

Blizzeq wants to merge 2 commits into
OpenSTEF:mainfrom
Blizzeq:chore/adopt-kaleido-1.4

Conversation

@Blizzeq

@Blizzeq Blizzeq commented Sep 17, 2026

Copy link
Copy Markdown

What does this PR do?

Lifts the kaleido pin in docs/ and examples/ from the deprecated 0.2.x line to >=1.4, and refreshes uv.lock.

Closes #938

The issue's acceptance criteria offered two routes: fix the plotter, or "confirm kaleido >1.3.x fixed the regression upstream". The second one is now met.

@egordm's analysis pinned the bug to _orjson_default in kaleido/_kaleido_tab/_tab.py, which only handled .tolist() and raised on pd.Timestamp, and noted that no upstream PR existed yet. One does now: plotly/Kaleido#461 by @gaoflow adds an isoformat() fallback for datetime-like objects, shipped in kaleido v1.4.0 on 2026-08-31. The fix itself is theirs; what this PR adds is the verification and the lift.

Because it sits in the central serializer rather than at a call site, it covers the paths the plotter-side workaround could not reach, which is why #942 reverted _normalize_x_data and constrained the dependency instead.

Verification

1. The call sites, 1.3.0 versus 1.4.0. Same script, same plotly 7.1.0 and pandas 3.0.5, only kaleido differs:

Figure content kaleido 1.3.0 kaleido 1.4.0
quantile-fill band (the repro in #938) TypeError: Type is not JSON serializable: Timestamp exports
add_vrect with Timestamp bounds same TypeError exports
layout.xaxis.range with Timestamps same TypeError exports
annotation anchored at a Timestamp same TypeError exports

The last three are the call sites #938 lists as not covered by the workaround.

2. The real plotter. ForecastTimeSeriesPlotter with measurements, a forecast and P10/P50/P90 bands, exported through pio.to_image, succeeds on 1.4.0 (60054 bytes). It also succeeds on 1.3.0, because _add_single_quantile_polygon already keeps x as a DatetimeIndex. That workaround is left untouched: it costs nothing and keeps the export robust against future regressions, as the issue describes.

3. The docs build. docs-check run on my fork against this branch: uv sync --frozen then poe docs, green on ubuntu-latest, 24.7 MB of HTML uploaded. nb_execution_mode is cache and a fresh runner has no cache, so the tutorials were executed and their figures exported through kaleido 1.4.0 rather than replayed.

Why >=1.4 and not >=1.0

1.0 through 1.3 still carry the Timestamp bug, so the floor has to be the release containing plotly/Kaleido#461.

This also resolves the other two reasons the pin mentioned: v1 is the maintained line, so the deprecated v0 goes away, and 1.4.0 ships a single py3-none-any wheel, so the missing macOS arm64 wheel that ruled out 0.2.1.post1 is no longer a factor. Note that v1 does not bundle a browser and uses a system Chrome or Chromium, which the CI runner already has, as the green docs build shows.

Type of change

  • Bug fix
  • New feature
  • Breaking change (see checklist below)
  • Documentation
  • Refactor / chore / CI

Breaking changes checklist

  • Public API, config schema, or serialized/pickled objects changed in a way that affects existing users

Not applicable: this only moves a docs/tutorial build dependency. No library code changes.

AI disclosure

  • No AI assistance was used (beyond grammar/spelling)
  • AI assistance was used — tool(s): Claude Opus 5, as a research and drafting aid under my direction
    • I have reviewed, understand, and can explain all AI-generated code in this PR
    • This is disclosed in a commit message (Assisted-by: Claude Opus 5)

Checklist

  • poe all --check passes locally
  • Tests added/updated for the change
  • Documentation updated (docstrings, user guide, examples) if needed
  • Commits are signed off per our DCO (git commit -s)
  • PR title follows Conventional Commits

On the two unchecked boxes: there is no code change to test, and the upstream behaviour is already covered by test_orjson_encoder.py in plotly/Kaleido#461. I ran the docs build rather than poe all --check, since that is the job this pin affects; happy to run the full check if you would like it on the record.

The docs and tutorial extras were pinned to the deprecated kaleido 0.2.x
because kaleido v1 raised "TypeError: Type is not JSON serializable:
Timestamp" when a figure spec carried pandas Timestamp values.

kaleido 1.4.0 handles datetime-like objects in its orjson fallback
(plotly/Kaleido#461), which is the upstream fix OpenSTEF#938 was waiting for, so
lift the constraint to >=1.4 and refresh the lock file.

Fixes OpenSTEF#938

Assisted-by: Claude Opus 5
Signed-off-by: Jakub Krasuski <kubamax4@gmail.com>
@Blizzeq
Blizzeq requested a review from a team September 17, 2026 22:11
@github-actions github-actions Bot added the chore Improvements or additions to documentation label Sep 17, 2026

@egordm egordm left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice find! Overall looks great.

Just a note to remove the comments that are no longer necessary since we no longer pin a specific version.

I will run some final checks tomorrow and merge.

Comment thread docs/pyproject.toml Outdated
Comment thread examples/pyproject.toml Outdated
They explained a constraint that no longer exists now that the version is
a plain lower bound. The reasoning stays in OpenSTEF#938 and the commit history.

Assisted-by: Claude Opus 5
Signed-off-by: Jakub Krasuski <kubamax4@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore: adopt kaleido 1.3+ (fix Timestamp serialization in plotter)

2 participants