From 0b4c1c664dcc1886f836014a9c347fd815e33756 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Mon, 9 Jun 2025 15:20:06 +0200 Subject: [PATCH 1/3] plotlyjs unsafe workaround --- .github/workflows/ci.yml | 1 + src/backends.jl | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc857cd33..ee77c95ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,7 @@ jobs: GKS_ENCODING: "utf8" GKSwstype: "nul" JULIA_CONDAPKG_BACKEND: "MicroMamba" + PLOTS_PLOTLYJS_UNSAFE_ELECTRON: "true" MPLBACKEND: "agg" name: Julia ${{ matrix.version }} - ${{ matrix.os }} continue-on-error: ${{ matrix.experimental }} diff --git a/src/backends.jl b/src/backends.jl index e88b25ae1..22f520065 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -848,6 +848,12 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10] # ------------------------------------------------------------------------------ # plotlyjs +function _post_imports(::PlotlyJSBackend) + if Base.get_bool_env("PLOTS_PLOTLYJS_UNSAFE_ELECTRON", false) + (Sys.islinux() && isdefined(PlotlyJS, :unsafe_electron)) && + PlotlyJS.unsafe_electron() + end +end const _plotlyjs_attr = _plotly_attr const _plotlyjs_seriestype = _plotly_seriestype From f15fb2a2aacd580037383392f5a03772c88783ad Mon Sep 17 00:00:00 2001 From: t-bltg Date: Mon, 9 Jun 2025 15:21:03 +0200 Subject: [PATCH 2/3] fix --- src/backends.jl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/backends.jl b/src/backends.jl index 22f520065..5c990232d 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -848,7 +848,8 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10] # ------------------------------------------------------------------------------ # plotlyjs -function _post_imports(::PlotlyJSBackend) +_post_imports(::PlotlyJSBackend) = @eval begin + const PlotlyJS = Main.PlotlyJS if Base.get_bool_env("PLOTS_PLOTLYJS_UNSAFE_ELECTRON", false) (Sys.islinux() && isdefined(PlotlyJS, :unsafe_electron)) && PlotlyJS.unsafe_electron() From 03ec6a31a1edd7af507830d81a1d1f70ad364434 Mon Sep 17 00:00:00 2001 From: t-bltg Date: Mon, 9 Jun 2025 16:30:56 +0200 Subject: [PATCH 3/3] support older julia vers --- src/backends.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends.jl b/src/backends.jl index 5c990232d..792ff18b8 100644 --- a/src/backends.jl +++ b/src/backends.jl @@ -850,7 +850,7 @@ const _pgfplots_scale = [:identity, :ln, :log2, :log10] # plotlyjs _post_imports(::PlotlyJSBackend) = @eval begin const PlotlyJS = Main.PlotlyJS - if Base.get_bool_env("PLOTS_PLOTLYJS_UNSAFE_ELECTRON", false) + if Plots.bool_env("PLOTS_PLOTLYJS_UNSAFE_ELECTRON", "false") (Sys.islinux() && isdefined(PlotlyJS, :unsafe_electron)) && PlotlyJS.unsafe_electron() end