Regression in kaleido 1.3.0 when saving plot with markers #458
Copy link
Copy link
Closed
Description
Observe the simple reproducible example at the end of the post . It works just fine when running it with
uv run --with pandas==2.3.3 --with numpy==2.4.4 --with plotly==6.7.0 --with kaleido==1.2.0 generate_plot_png.py
When I run the same script but with kaleido==1.3.0, it raises an exception.
TypeError: Type is not JSON serializable: Timestamp
Command:
uv run --with pandas==2.3.3 --with numpy==2.4.4 --with plotly==6.7.0 --with kaleido==1.3.0 generate_plot_png.py
Code:
import numpy as np
import pandas as pd
import plotly.graph_objects as go
def generate_dataframe() -> pd.DataFrame:
rng = np.random.default_rng(42)
index = pd.bdate_range("2026-01-30", "2026-06-03")
data = {
"col_1": np.round(rng.uniform(10.0, 30.0, len(index))),
"col_2": np.round(rng.uniform(1.0, 30.0, len(index))),
"col_3": np.round(rng.uniform(20.0, 50.0, len(index))),
"col_4": np.round(rng.uniform(4.0, 100.0, len(index))),
"col_5": np.round(rng.uniform(30.0, 40.0, len(index))),
}
df = pd.DataFrame(data, index=index).astype("float64")
df.index = df.index.astype("datetime64[ns]")
return df
df = generate_dataframe()
fig = go.Figure()
for c in df.columns:
fig.add_trace(
go.Scatter(
x=df.index,
y=df[c],
name=c,
mode="lines",
)
)
# Last point marker + label
# SOMETHING HERE MAKES IT FAIL
last_idx = df[c].last_valid_index()
if last_idx is not None:
last_val = df.loc[last_idx, c]
fig.add_trace(
go.Scatter(
x=[last_idx],
y=[last_val],
mode="markers",
showlegend=False,
hoverinfo="skip",
)
)
fig.write_image("plot1.png")
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
camdecoster commentedon Jun 10, 2026
Thanks for the bug report! It looks like there's already a PR to address this in #461. We'll review that and hopefully close this issue.
StageTired commentedon Jul 6, 2026
Any progress here? The PR has been open for a month already
awiol commentedon Jul 7, 2026
Related to #465
Serialize datetime-like values in _orjson_default (fixes #458)