Skip to content

Expose plotly.io.get_chrome() #5282

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 16, 2025
Merged

Expose plotly.io.get_chrome() #5282

merged 3 commits into from
Jul 16, 2025

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

Bug Report: plotly.io.install_chrome() documented but doesn't exist
3 participants