Skip to content

Handle Decimal in Kaleido JSON serialization#455

Merged
emilykl merged 1 commit into
plotly:masterfrom
Sean-Kenneth-Doherty:fix-decimal-orjson-default
May 25, 2026
Merged

Handle Decimal in Kaleido JSON serialization#455
emilykl merged 1 commit into
plotly:masterfrom
Sean-Kenneth-Doherty:fix-decimal-orjson-default

Conversation

@Sean-Kenneth-Doherty
Copy link
Copy Markdown
Contributor

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty commented May 17, 2026

Summary

Kaleido's orjson serializer now converts decimal.Decimal values to floats, matching Plotly's JSON encoder behavior. This keeps figures containing Decimal values serializable after the 1.3.0 switch to orjson.

Fixes #453

Validation

  • env TMPDIR=/home/sean/.cache uv run pytest tests/test_kaleido_tab.py tests/test_init.py tests/test_fig_tools.py tests/test_path_tools.py -q -W error: 280 passed
  • env TMPDIR=/home/sean/.cache uv run ruff check kaleido/_kaleido_tab/_tab.py tests/test_kaleido_tab.py: passed
  • env TMPDIR=/home/sean/.cache uv run ruff format --check kaleido/_kaleido_tab/_tab.py tests/test_kaleido_tab.py: 2 files already formatted
  • git diff --check origin/master...HEAD: passed

@Sean-Kenneth-Doherty Sean-Kenneth-Doherty marked this pull request as ready for review May 17, 2026 01:23
@Sean-Kenneth-Doherty
Copy link
Copy Markdown
Contributor Author

Local validation after refreshing the branch:

  • uv run pytest tests/test_kaleido_tab.py::test_orjson_default_handles_decimal -q -> 1 passed
  • uv run pytest tests/test_fig_tools.py tests/test_kaleido_tab.py -q -> 257 passed
  • git diff --check origin/master...HEAD -> clean

Copy link
Copy Markdown
Collaborator

@emilykl emilykl left a comment

Choose a reason for hiding this comment

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

Thanks @Sean-Kenneth-Doherty for this fix! Looks good.

@emilykl emilykl merged commit d1a42ee into plotly:master May 25, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Kaleido version 1.3.0 can't handle Decimals

3 participants