Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support Kaleido v1 in Plotly.py#5062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
emilykl merged 57 commits intomainfromupgrade-kaleido
Apr 29, 2025
Merged

Support Kaleido v1 in Plotly.py#5062

emilykl merged 57 commits intomainfromupgrade-kaleido
Apr 29, 2025

Conversation

@emilykl
Copy link
Contributor

@emilyklemilykl commentedMar 4, 2025
edited
Loading

Support both the Kaleido v0 and v1 APIs in Plotly.py.

  • Updatefig.write_image(),fig.to_image(),pio.write_image(), andpio.to_image() to work with both Kaleido versions
  • Add deprecation warnings for:
    • theengine argument toto_image() andwrite_image()
    • Use of Orca
    • Use of Kaleido v0
    • Setting defaults viakaleido.scope.*
  • Add a new way of setting image export defaults:plotly.io.defaults.*. This can be used in place ofkaleido.scope.* and supports all the same settings:default_format,default_height,default_width,default_scale,mathjax, andtopojson.pio.defaults is backwards-compatible with Kaleido v0.
  • Addpio.write_images() function for generating multiple images at a time
    • Required due to the new Kaleido architecture;much faster than callingwrite_image() in a loop
    • Addpio.get_chrome() function which wrapskaleido.get_chrome_sync(), and add a CLI entry pointplotly_get_chrome for installing Chrome from the command line
  • Updatetests/test_optional/test_kaleido/test_kaleido.py tests to work with either Kaleido v0 or v1. They now also actually check that an image of the right format and dimensions has been generated, as opposed to using mocking to check that the right arguments are being passed to Kaleido.
  • Add test forpio.write_images()
  • Update CI to run all tests with Kaleido v1, and add an additional job which runs the Kaleido tests with Kaleido v0, to protect against regressions

TODO

  • Update CI to run all tests with Kaleido v1
  • Add CI job to run Kaleido tests with Kaleido v0
  • Finalize UX for what happens if Chrome is not found
  • Finalize UX / API for EPS
  • Figure out what to do about 'renderers' Kaleido test
  • Add deprecation warning forengine argument towrite_image /to_image
  • Re-add removed Orca support but with DeprecationWarning
  • Fix DeprecationWarnings not showing up
  • Expose API for setting defaultmathjax andtopojson

ndrezn reacted with rocket emoji
Copy link
Contributor

@gvwilsongvwilson left a comment

Choose a reason for hiding this comment

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

Left a few comments and a question, happy to read through again as soon as you want.

- 'webp'
- 'svg'
- 'pdf'
- 'eps' (Requires the poppler library to be installed and on the PATH)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we still handle EPS?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

@gvwilson Following up on this — Kaleido v1 does not support EPS yet. So either we drop support for EPS entirely, or document that EPS is only available with Kaleido v0 and add an informative error message.

Copy link
Contributor

Choose a reason for hiding this comment

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

please do the latter - thanks

emilykl and LiamConnors reacted with thumbs up emoji
- "kaleido": Use Kaleido for image export
- "orca": Use Orca for image export
- "auto" (default): Use Kaleido if installed, otherwise use orca
engine (deprecated): str
Copy link
Contributor

Choose a reason for hiding this comment

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

do we print a deprecation warning if this argument is used?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Not yet, assuming we are in agreement about removing this argument, I'll add one

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm in agreement that we should remove this argument

emilykl reacted with thumbs up emoji
defcheck_image(path_or_buffer,size=(700,500),format="PNG"):
ifformat=="PDF":
img=PdfReader(path_or_buffer)
# TODO: There is a conversion factor needed here
Copy link
Contributor

Choose a reason for hiding this comment

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

why?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Part of the TODO is for me to educate myself on how Plotly currently determines PDF size when writing to PDF. :)

But thesize argument is measured in pixels (at least for raster file types) and PDFs have no concept of pixels so I wouldn't expect the PDF to report the same "size" as passed in the argument necessarily.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will also take a looksy on that issue, lets say for this and the above tomorrow. I am flying today.

@emilykl
Copy link
ContributorAuthor

cc@ayjayt

@marthacryan
Copy link
Collaborator

Do we need to maintain backwards compatibility with older Kaleido versions here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there percy tests that use kaleido to make sure that the actual images generated are correct?

@emilykl
Copy link
ContributorAuthor

Quick comment to note that commit54985b8 on this branch has been released as beta versionv6.1.0b0.

@emilyklemilykl merged commit7702233 intomainApr 29, 2025
6 checks passed
@gvwilsongvwilson deleted the upgrade-kaleido branchJune 4, 2025 12:42
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@marthacryanmarthacryanmarthacryan left review comments

@LiamConnorsLiamConnorsLiamConnors left review comments

+2 more reviewers

@ayjaytayjaytayjayt left review comments

@gvwilsongvwilsongvwilson approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

@emilyklemilykl

Labels

featuresomething newP1needed for current cycle

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@emilykl@marthacryan@gvwilson@LiamConnors@ayjayt

[8]ページ先頭

©2009-2025 Movatter.jp