Skip to content

Commit

Permalink
fix: do not require plotly or bokeh when holoviews is used (#2199)
Browse files Browse the repository at this point in the history
Using holoviews was failing if plotly or bokeh was not installed. It has
been fixed by verifying if they are available before applying a theme
for it in HoloviewsFormatter.
  • Loading branch information
mb-915 authored Sep 3, 2024
1 parent 3896c99 commit 2a85406
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions marimo/_dependencies/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ class DependencyManager:
duckdb = Dependency("duckdb")
pillow = Dependency("PIL")
plotly = Dependency("plotly")
bokeh = Dependency("bokeh")
pyarrow = Dependency("pyarrow")
openai = Dependency("openai")
matplotlib = Dependency("matplotlib")
Expand Down
14 changes: 8 additions & 6 deletions marimo/_output/formatters/holoviews_formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ def _show_chart(
def apply_theme(self, theme: Theme) -> None:
import holoviews as hv # type: ignore

hv.renderer("bokeh").theme = (
"dark_minimal" if theme == "dark" else None
)
hv.renderer("plotly").theme = (
"plotly_dark" if theme == "dark" else "plotly"
)
if DependencyManager.bokeh.has():
hv.renderer("bokeh").theme = (
"dark_minimal" if theme == "dark" else None
)
if DependencyManager.plotly.has():
hv.renderer("plotly").theme = (
"plotly_dark" if theme == "dark" else "plotly"
)

0 comments on commit 2a85406

Please sign in to comment.