Skip to content

Commit

Permalink
Always use Requires for IJulia
Browse files Browse the repository at this point in the history
Addresses issue #4719.
  • Loading branch information
oschulz committed May 19, 2023
1 parent 552328c commit 71a5db7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ Unzip = "41fe7b60-77ed-43a1-b4f0-825fd5a5650d"
[weakdeps]
FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549"
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a"
ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254"
Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"

[extensions]
FileIOExt = "FileIO"
GeometryBasicsExt = "GeometryBasics"
IJuliaExt = "IJulia"
ImageInTerminalExt = "ImageInTerminal"
UnitfulExt = "Unitful"

Expand Down
4 changes: 3 additions & 1 deletion ext/IJuliaExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ module IJuliaExt
import Plots: @ext_imp_use, Plots, Plot
using Base64

@ext_imp_use :import IJulia
# Change back when loading as extension again:
#@ext_imp_use :import IJulia
import ..IJulia

function _init_ijulia_plotting()
# IJulia is more stable with local file
Expand Down
10 changes: 7 additions & 3 deletions src/init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ function __init__()
@require GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326" include(
normpath(@__DIR__, "..", "ext", "GeometryBasicsExt.jl"),
)
@require IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" include(
normpath(@__DIR__, "..", "ext", "IJuliaExt.jl"),
)
@require ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254" include(
normpath(@__DIR__, "..", "ext", "ImageInTerminalExt.jl"),
)
Expand All @@ -75,6 +72,13 @@ function __init__()
)
end

# Always use @require for IJuliaExt until the Julia >=v1.9 can cleanly
# load extensions that depend on packages in a non-top-level environment.
# See Plots issue #4719.
@require IJulia = "7073ff75-c697-5162-941a-fcdaad2a7d2a" include(
normpath(@__DIR__, "..", "ext", "IJuliaExt.jl"),
)

_runtime_init(backend())
nothing
end
Expand Down

0 comments on commit 71a5db7

Please sign in to comment.