Skip to content

Conversation

@ayjayt
Copy link
Collaborator

@ayjayt ayjayt commented Aug 21, 2025

Refactors internal Kaleido tab API to remove code duplication and properly split functionality into separate modules.

Mostly no user-facing changes, except as outlined below under "API changes."

API changes

  • kaleido.write_fig, kaleido.write_fig_sync, kaleido.write_fig_from_object, kaleido.write_fig_from_object_sync

    • new argument cancel_on_error for multi-image generation:
      • if False (default): continue generating even if one image fails (previously, if an image failed generation, an error would be surfaced in the asyncio task, but generation would continue)
      • if True: if one image generation fails with error, surface error immediately to surrounding function
    • added return value (previously None):
      • if cancel_on_error=False: returns tuple of Exceptions corresponding to failed image generations (if no failures, returns a zero-length tuple)
      • if cancel_on_error=True: returns None (or raises an exception)
  • kaleido.calc_fig and kaleido.calc_fig_sync:

    • path argument deprecated (it was previously unused, EXCEPT as one way of setting the output file type). Anyone using the path argument to set output file type should use calc_fig(opts=dict(format="...", ...)) instead
  • Remove error_log argument from all of the above functions (undocumented, probably unused)

ayjayt added 5 commits August 20, 2025 11:43
Refactors often touch a lot of parts, and this is a pretty big refactor.
We reduce code deplication, improve errors and logic, and simply task
management.
@gvwilson gvwilson added feature something new P1 needs immediate attention labels Aug 22, 2025
Some of these may have been legit errors found by pyright, some of it
is just pyright not accepting certain patterns.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ayjayt Can you add docstrings to the functions in this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we're at a decent time to start docing things yeah, now that its stable

v1.3.0
- Significant refactor, better organization
- `write_fig` and `_from_object` now take an additional argument:
`cancel_on_error: bool`. If False, default True, returns a list of errors.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@ayjayt Does cancel_on_error default to False or True? Is there a docstring anywhere listing the accepted arguments and their defaults?

@emilykl
Copy link
Collaborator

emilykl commented Dec 10, 2025

@ayjayt Your changes deprecating the path argument (rather than removing it) have not been pushed yet correct?

@ayjayt
Copy link
Collaborator Author

ayjayt commented Dec 10, 2025

@ayjayt Your changes deprecating the path argument (rather than removing it) have not been pushed yet correct?

a0d5b0f

(its not in __init__, its in what __init__ wraps)

@ayjayt ayjayt requested a review from emilykl December 10, 2025 23:38
@ayjayt
Copy link
Collaborator Author

ayjayt commented Dec 11, 2025

free threaded failing due to orjson dep, i think that's okay, its a unique use case, I made an issue:

https://github.com/plotly/Kaleido/actions/runs/20118129180/job/57732318221

matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python_v: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', '']
python_v: ['3.8', '3.9', '3.10', '3.12', '3.13', '3.14', '3.14t']
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
python_v: ['3.8', '3.9', '3.10', '3.12', '3.13', '3.14', '3.14t']
python_v: ['3.8', '3.9', '3.10', '3.12', '3.13', '3.14']

@ayjayt Let's drop 3.14t from the CI until it runs successfully. (Or mark as expected to fail, if GHA provides a way to do that.) Keep the CI green.

Copy link
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.

Looks good to me @ayjayt, all good to merge if you are ready 🚀

@emilykl
Copy link
Collaborator

emilykl commented Dec 15, 2025

@ayjayt Is this ready to merge?

@ayjayt ayjayt merged commit 725729f into master Dec 15, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature something new P1 needs immediate attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants