Skip to content

Expose plotly.io.get_chrome()#5282

Merged
emilykl merged 3 commits intomainfrom
5272-add-plotly-io-get-chrome
Jul 16, 2025
Merged

Expose plotly.io.get_chrome()#5282
emilykl merged 3 commits intomainfrom
5272-add-plotly-io-get-chrome

Conversation

@emilykl
Copy link
Contributor

@emilykl emilykl commented Jul 16, 2025

Closes #5272

Expose plotly.io.get_chrome() as a function which can be called from within a Python script.

get_chrome() accepts one optional argument, path, which is the location to download Chrome to; if not supplied, the default location defined by choreographer will be used.

This PR also slightly refactors get_chrome() into two functions:

  • get_chrome(), which is intended to be called directly in code, and
  • plotly_get_chrome(), which is a CLI wrapper for get_chrome() and intended to be called via the plotly_get_chrome command from the command line.

On this branch, running the following code should work:

import plotly.io as pio

pio.get_chrome()
@emilykl emilykl requested review from LiamConnors and gvwilson July 16, 2025 19:07
The path to the directory where Chrome should be installed.
If None, the default download path will be used.
"""
if not kaleido_available() or kaleido_major() < 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

why a confirmation? (not arguing, just think it's very unlikely someone would call the function by accident)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean the one on line 837? I agree it's unlikely to be called by accident, but I mainly put it there so users could confirm that the install path makes sense.

In any case, the confirmation only appears when using the command-line plotly_get_chrome command, not when calling the plotly.io.get_chrome() function within a script.

@emilykl emilykl merged commit 4cd70ad into main Jul 16, 2025
10 checks passed
@emilykl emilykl deleted the 5272-add-plotly-io-get-chrome branch November 6, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants