Skip to content

Commit

Permalink
Revert use of package extensions
Browse files Browse the repository at this point in the history
Currently experiencing cyclic dependency warnings when using the worker package
along with system images that contain packages that are dependencies of the
extensions themselves. For the time being until the issue can be resolved we
will use use `Requires.jl` for the extension loading mechanism instead.
  • Loading branch information
MichaelHatherly committed Oct 18, 2024
1 parent ba525c5 commit 16c9cec
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 42 deletions.
54 changes: 27 additions & 27 deletions src/QuartoNotebookWorker/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,32 @@ Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
TOML = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[weakdeps]
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
SymPyCore = "458b697b-88f0-4a86-b56b-78b75cfb3531"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[extensions]
QuartoNotebookWorkerCairoMakieExt = "CairoMakie"
QuartoNotebookWorkerDataFramesTablesExt = ["DataFrames", "Tables"]
QuartoNotebookWorkerJSONExt = "JSON"
QuartoNotebookWorkerLaTeXStringsExt = "LaTeXStrings"
QuartoNotebookWorkerMakieExt = "Makie"
QuartoNotebookWorkerPlotlyBaseExt = "PlotlyBase"
QuartoNotebookWorkerPlotlyJSExt = "PlotlyJS"
QuartoNotebookWorkerPlotsExt = "Plots"
QuartoNotebookWorkerRCallExt = "RCall"
QuartoNotebookWorkerReviseExt = "Revise"
QuartoNotebookWorkerSymPyCoreExt = "SymPyCore"

# [weakdeps]
# CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
# DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
# JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
# LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f"
# Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a"
# PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5"
# PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a"
# Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
# RCall = "6f49c342-dc21-5d91-9882-a32aef131414"
# Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
# SymPyCore = "458b697b-88f0-4a86-b56b-78b75cfb3531"
# Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
#
# [extensions]
# QuartoNotebookWorkerCairoMakieExt = "CairoMakie"
# QuartoNotebookWorkerDataFramesTablesExt = ["DataFrames", "Tables"]
# QuartoNotebookWorkerJSONExt = "JSON"
# QuartoNotebookWorkerLaTeXStringsExt = "LaTeXStrings"
# QuartoNotebookWorkerMakieExt = "Makie"
# QuartoNotebookWorkerPlotlyBaseExt = "PlotlyBase"
# QuartoNotebookWorkerPlotlyJSExt = "PlotlyJS"
# QuartoNotebookWorkerPlotsExt = "Plots"
# QuartoNotebookWorkerRCallExt = "RCall"
# QuartoNotebookWorkerReviseExt = "Revise"
# QuartoNotebookWorkerSymPyCoreExt = "SymPyCore"
#
[preferences.QuartoNotebookWorker]
packages = []
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerCairoMakieExt

import QuartoNotebookWorker
import CairoMakie
import ..CairoMakie

function configure()
fm = QuartoNotebookWorker._figure_metadata()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module QuartoNotebookWorkerDataFramesTablesExt

import QuartoNotebookWorker
import DataFrames
import Tables
import ..DataFrames
import ..Tables

QuartoNotebookWorker._ojs_convert(df::DataFrames.AbstractDataFrame) = Tables.rows(df)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerJSONExt

import QuartoNotebookWorker
import JSON
import ..JSON

function QuartoNotebookWorker._ojs_define(::QuartoNotebookWorker.OJSDefine, kwargs)
contents = QuartoNotebookWorker.ojs_convert(kwargs)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerLaTeXStringsExt

import QuartoNotebookWorker as QNW
import LaTeXStrings as LS
import ..LaTeXStrings as LS

QNW._mimetype_wrapper(s::LS.LaTeXString) = LaTeXStringWrapper(s)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerMakieExt

import QuartoNotebookWorker
import Makie
import ..Makie

function configure()
fm = QuartoNotebookWorker._figure_metadata()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerPlotlyBaseExt

import QuartoNotebookWorker
import PlotlyBase
import ..PlotlyBase

struct PlotlyBasePlotWithoutRequireJS
plot::PlotlyBase.Plot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerPlotlyJSExt

import QuartoNotebookWorker
import PlotlyJS
import ..PlotlyJS

QuartoNotebookWorker.expand(p::PlotlyJS.SyncPlot) = QuartoNotebookWorker.expand(p.plot)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerPlotsExt

import QuartoNotebookWorker
import Plots
import ..Plots

function configure()
fm = QuartoNotebookWorker._figure_metadata()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerRCallExt

import QuartoNotebookWorker
import RCall
import ..RCall

const RCall_temp_files_ref = Ref{String}()
const rcalljl_device_ref = Ref{Symbol}(:png)
Expand Down
4 changes: 2 additions & 2 deletions src/QuartoNotebookWorker/ext/QuartoNotebookWorkerReviseExt.jl
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module QuartoNotebookWorkerReviseExt

import Revise
import ..Revise
import QuartoNotebookWorker

function __init__()
@debug "extension has been loaded" Revise QuartoNotebookWorker
@info "extension has been loaded" Revise QuartoNotebookWorker
end

end
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module QuartoNotebookWorkerSymPyCoreExt

import QuartoNotebookWorker as QNW
import SymPyCore as SPC
import ..SymPyCore as SPC

QNW._mimetype_wrapper(s::SPC.SymbolicObject) = SymWrapper(s)
QNW._mimetype_wrapper(s::AbstractArray{<:SPC.Sym}) = SymWrapper(s)
Expand Down
38 changes: 36 additions & 2 deletions src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,43 @@ end
# Handle older versions of Julia that don't have support for package extensions.
# Note that this macro must be called in the root-module of a package, otherwise
# `pathof(__module__)` will be `nothing`.
import .Packages.PackageExtensionCompat: @require_extensions
import .Packages.Requires
function __init__()
@require_extensions
Requires.@require CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0" include(
"../ext/QuartoNotebookWorkerCairoMakieExt.jl",
)
Requires.@require DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" begin
Requires.@require Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" include(
"../ext/QuartoNotebookWorkerDataFramesTablesExt.jl",
)
end
Requires.@require JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" include(
"../ext/QuartoNotebookWorkerJSONExt.jl",
)
Requires.@require LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" include(
"../ext/QuartoNotebookWorkerLaTeXStringsExt.jl",
)
Requires.@require Makie = "ee78f7c6-11fb-53f2-987a-cfe4a2b5a57a" include(
"../ext/QuartoNotebookWorkerMakieExt.jl",
)
Requires.@require PlotlyBase = "a03496cd-edff-5a9b-9e67-9cda94a718b5" include(
"../ext/QuartoNotebookWorkerPlotlyBaseExt.jl",
)
Requires.@require PlotlyJS = "f0f68f2c-4968-5e81-91da-67840de0976a" include(
"../ext/QuartoNotebookWorkerPlotlyJSExt.jl",
)
Requires.@require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" include(
"../ext/QuartoNotebookWorkerPlotsExt.jl",
)
Requires.@require RCall = "6f49c342-dc21-5d91-9882-a32aef131414" include(
"../ext/QuartoNotebookWorkerRCallExt.jl",
)
Requires.@require Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" include(
"../ext/QuartoNotebookWorkerReviseExt.jl",
)
Requires.@require SymPyCore = "458b697b-88f0-4a86-b56b-78b75cfb3531" include(
"../ext/QuartoNotebookWorkerSymPyCoreExt.jl",
)
end

# Imports.
Expand Down

0 comments on commit 16c9cec

Please sign in to comment.