From 6fb57b1d3e491cd87cc3df224b33abbdd459dc4d Mon Sep 17 00:00:00 2001 From: MichaelHatherly Date: Fri, 18 Oct 2024 14:00:48 +0100 Subject: [PATCH] Revert use of package extensions 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. --- Project.toml | 3 +- src/QuartoNotebookWorker/Project.toml | 54 +++++++++---------- .../ext/QuartoNotebookWorkerCairoMakieExt.jl | 2 +- ...QuartoNotebookWorkerDataFramesTablesExt.jl | 4 +- .../ext/QuartoNotebookWorkerJSONExt.jl | 2 +- .../QuartoNotebookWorkerLaTeXStringsExt.jl | 2 +- .../ext/QuartoNotebookWorkerMakieExt.jl | 2 +- .../ext/QuartoNotebookWorkerPlotlyBaseExt.jl | 2 +- .../ext/QuartoNotebookWorkerPlotlyJSExt.jl | 2 +- .../ext/QuartoNotebookWorkerPlotsExt.jl | 2 +- .../ext/QuartoNotebookWorkerRCallExt.jl | 2 +- .../ext/QuartoNotebookWorkerReviseExt.jl | 4 +- .../ext/QuartoNotebookWorkerSymPyCoreExt.jl | 2 +- .../src/QuartoNotebookWorker.jl | 38 ++++++++++++- src/WorkerSetup.jl | 4 +- 15 files changed, 79 insertions(+), 46 deletions(-) diff --git a/Project.toml b/Project.toml index ecea5bd..b4570e7 100644 --- a/Project.toml +++ b/Project.toml @@ -13,13 +13,13 @@ IterTools = "c8e1da08-722c-5040-9ed9-7db0dc04731e" JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1" Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" Malt = "36869731-bdee-424d-aa32-cab38c994e3b" -PackageExtensionCompat = "65ce6f38-6b18-4e1d-a461-8949797d7930" Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a" ProgressLogging = "33c8b6b6-d38a-422a-b730-caa89a2f386c" REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" RelocatableFolders = "05181044-ff0b-4ac5-8273-598c1e38db00" +Requires = "ae029012-a4dd-5104-9daa-d747884805df" SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce" Scratch = "6c6a2e73-6563-6170-7368-637461726353" Sockets = "6462fe0b-24de-5631-8697-dd941f90decc" @@ -36,7 +36,6 @@ IterTools = "1" JSON3 = "1" Logging = "1.6" Malt = "1" -PackageExtensionCompat = "1" Pkg = "1.6" PrecompileTools = "1" ProgressLogging = "0.1.4" diff --git a/src/QuartoNotebookWorker/Project.toml b/src/QuartoNotebookWorker/Project.toml index cf0f4c4..a986bd7 100644 --- a/src/QuartoNotebookWorker/Project.toml +++ b/src/QuartoNotebookWorker/Project.toml @@ -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 = [] diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerCairoMakieExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerCairoMakieExt.jl index 37e666f..ec12643 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerCairoMakieExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerCairoMakieExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerCairoMakieExt import QuartoNotebookWorker -import CairoMakie +import ..CairoMakie function configure() fm = QuartoNotebookWorker._figure_metadata() diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerDataFramesTablesExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerDataFramesTablesExt.jl index 1a941ba..2af0afe 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerDataFramesTablesExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerDataFramesTablesExt.jl @@ -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) diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerJSONExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerJSONExt.jl index 9affa56..f422a98 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerJSONExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerJSONExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerJSONExt import QuartoNotebookWorker -import JSON +import ..JSON function QuartoNotebookWorker._ojs_define(::QuartoNotebookWorker.OJSDefine, kwargs) contents = QuartoNotebookWorker.ojs_convert(kwargs) diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerLaTeXStringsExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerLaTeXStringsExt.jl index 531f5b5..aeac18c 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerLaTeXStringsExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerLaTeXStringsExt.jl @@ -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) diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerMakieExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerMakieExt.jl index 910f199..4249c0e 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerMakieExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerMakieExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerMakieExt import QuartoNotebookWorker -import Makie +import ..Makie function configure() fm = QuartoNotebookWorker._figure_metadata() diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyBaseExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyBaseExt.jl index a880295..aa9fdc2 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyBaseExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyBaseExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerPlotlyBaseExt import QuartoNotebookWorker -import PlotlyBase +import ..PlotlyBase struct PlotlyBasePlotWithoutRequireJS plot::PlotlyBase.Plot diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyJSExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyJSExt.jl index b25cb6e..4b0ae81 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyJSExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotlyJSExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerPlotlyJSExt import QuartoNotebookWorker -import PlotlyJS +import ..PlotlyJS QuartoNotebookWorker.expand(p::PlotlyJS.SyncPlot) = QuartoNotebookWorker.expand(p.plot) diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotsExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotsExt.jl index 880ad51..e576fca 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotsExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerPlotsExt.jl @@ -1,7 +1,7 @@ module QuartoNotebookWorkerPlotsExt import QuartoNotebookWorker -import Plots +import ..Plots function configure() fm = QuartoNotebookWorker._figure_metadata() diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerRCallExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerRCallExt.jl index 672e4fc..e1ffeb6 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerRCallExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerRCallExt.jl @@ -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) diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerReviseExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerReviseExt.jl index 613773b..0fce08c 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerReviseExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerReviseExt.jl @@ -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 diff --git a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerSymPyCoreExt.jl b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerSymPyCoreExt.jl index bc74055..5a08649 100644 --- a/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerSymPyCoreExt.jl +++ b/src/QuartoNotebookWorker/ext/QuartoNotebookWorkerSymPyCoreExt.jl @@ -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) diff --git a/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl b/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl index ad095b7..930a21a 100644 --- a/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl +++ b/src/QuartoNotebookWorker/src/QuartoNotebookWorker.jl @@ -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. diff --git a/src/WorkerSetup.jl b/src/WorkerSetup.jl index 35744b5..04184c4 100644 --- a/src/WorkerSetup.jl +++ b/src/WorkerSetup.jl @@ -24,7 +24,7 @@ import TOML # Vendored packages. import IOCapture -import PackageExtensionCompat +import Requires # Dependency detection. @@ -103,7 +103,7 @@ end const VENDORED_PACKAGES = package_information([ # This contains the entry point files for each vendored package. IOCapture, - PackageExtensionCompat, + Requires, ]) # So that we key the loader environment on the vendored package versions.