From bfa905c5dd2ffa9da018ffd382fe4f7320f770fb Mon Sep 17 00:00:00 2001 From: Jesse Chan <1156048+jlchan@users.noreply.github.com> Date: Tue, 21 May 2024 17:29:38 -0500 Subject: [PATCH] Remove Requires.jl (#169) * remove Requires statements in SummationByPartsOperators.jl ext * remove requires statements in StartUpDG.jl * add Plots extension * remove unnecessary [extras] section (since we have test/Project.toml) * remove unnecessary compat restriction on SummationByPartsOperators.jl * add TriangulatePlotExt * remove Requires.jl * add to NEWS.md --- NEWS.md | 2 ++ Project.toml | 11 +++----- ext/StartUpDGSummationByPartsOperatorsExt.jl | 28 ++++++------------- .../TriangulatePlotsExt.jl | 4 +-- src/StartUpDG.jl | 16 ----------- test/Project.toml | 2 +- 6 files changed, 17 insertions(+), 46 deletions(-) rename src/TriangulatePlots.jl => ext/TriangulatePlotsExt.jl (96%) diff --git a/NEWS.md b/NEWS.md index ea6642a2..44e9a07f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -17,6 +17,8 @@ Most of the major changes are tracked in this [PR](https://github.com/jlchan/Sta * Removed SimpleUnpack.jl as a dependency. Loading StartUpDG.jl will no longer reexport `@unpack`, since destructuring via `(; propertyname) = x` is supported natively in Julia 1.7 and up. * Updated to NodesAndModes v1, which changed the ordering of triangle nodes to make them consistent with tet node ordering. * We introduced a `MultidimensionalQuadrature` type. All `Polynomial` approximation types now utilize either `MultidimensionalQuadrature` or `TensorProductQuadrature` as a type parameter. The previous type parameter `DefaultPolynomialType` is now simply used to determine the default quadrature type parameter. Note that this is internal behavior and should not impact standard usage of StartUpDG.jl. +* Removed Requires.jl in favor of [package extensions](https://pkgdocs.julialang.org/v1/creating-packages/#Conditional-loading-of-code-in-packages-(Extensions)) for Plots.jl and SummationByPartsOperators.jl dependencies. + ## Changes when updating to v0.17 diff --git a/Project.toml b/Project.toml index 20e60be0..8047a7bd 100644 --- a/Project.toml +++ b/Project.toml @@ -15,7 +15,6 @@ Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7" RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" RecursiveArrayTools = "731186ca-8d62-57ce-b412-fbd966d074cd" Reexport = "189a3867-3050-52da-a836-e630ba90ab69" -Requires = "ae029012-a4dd-5104-9daa-d747884805df" Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" @@ -23,10 +22,12 @@ Triangulate = "f7e6ffb2-c36d-4f8f-a77e-16e897189344" WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192" [weakdeps] +Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240" [extensions] StartUpDGSummationByPartsOperatorsExt = "SummationByPartsOperators" +TriangulatePlotsExt = "Plots" [compat] ConstructionBase = "1" @@ -38,14 +39,10 @@ PathIntersections = "0.1, 0.2" RecipesBase = "1" RecursiveArrayTools = "3" Reexport = "1" -Requires = "1" Setfield = "1" SparseArrays = "1" StaticArrays = "1" -SummationByPartsOperators = "0.5.52" +SummationByPartsOperators = "0.5" Triangulate = "2" WriteVTK = "1" -julia = "1.10" - -[extras] -SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240" +julia = "1.10" \ No newline at end of file diff --git a/ext/StartUpDGSummationByPartsOperatorsExt.jl b/ext/StartUpDGSummationByPartsOperatorsExt.jl index e036cda8..f0db42c2 100644 --- a/ext/StartUpDGSummationByPartsOperatorsExt.jl +++ b/ext/StartUpDGSummationByPartsOperatorsExt.jl @@ -6,26 +6,14 @@ using SparseArrays: sparse, droptol!, spzeros using StartUpDG # Required for visualization code -if isdefined(Base, :get_extension) - using SummationByPartsOperators: - SummationByPartsOperators, - DerivativeOperator, - grid, - AbstractDerivativeOperator, - AbstractNonperiodicDerivativeOperator, - PeriodicDerivativeOperator, - AbstractPeriodicDerivativeOperator -else - # Until Julia v1.9 is the minimum required version for Trixi.jl, we still support Requires.jl - using ..SummationByPartsOperators - using ..SummationByPartsOperators: - AbstractDerivativeOperator, - AbstractPeriodicDerivativeOperator, - AbstractNonperiodicDerivativeOperator, - DerivativeOperator, - PeriodicDerivativeOperator, - grid -end +using SummationByPartsOperators: + SummationByPartsOperators, + DerivativeOperator, + grid, + AbstractDerivativeOperator, + AbstractNonperiodicDerivativeOperator, + PeriodicDerivativeOperator, + AbstractPeriodicDerivativeOperator function construct_1d_operators(D::AbstractDerivativeOperator, tol) nodes_1d = collect(grid(D)) diff --git a/src/TriangulatePlots.jl b/ext/TriangulatePlotsExt.jl similarity index 96% rename from src/TriangulatePlots.jl rename to ext/TriangulatePlotsExt.jl index 1fcc6669..7c44d4b9 100644 --- a/src/TriangulatePlots.jl +++ b/ext/TriangulatePlotsExt.jl @@ -1,8 +1,8 @@ -module TriangulatePlots +module TriangulatePlotsExt using StartUpDG: BoundaryTagPlotter, RecipesBase -using ..Plots: Plots +using Plots: Plots RecipesBase.@recipe function f(m::BoundaryTagPlotter) triout = m.triout diff --git a/src/StartUpDG.jl b/src/StartUpDG.jl index b48306c9..e7ad42df 100644 --- a/src/StartUpDG.jl +++ b/src/StartUpDG.jl @@ -103,20 +103,4 @@ export CircularDomain, PartialCircularDomain include("explicit_timestep_utils.jl") export ck45 # LSERK 45 - -using Requires: @require - -function __init__() - @require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" begin - include("TriangulatePlots.jl") - end - - # Until Julia v1.9 is the minimum required version for StartUpDG.jl, we still support Requires.jl - @static if !isdefined(Base, :get_extension) - @require SummationByPartsOperators = "9f78cca6-572e-554e-b819-917d2f1cf240" begin - include("../ext/StartUpDGSummationByPartsOperatorsExt.jl") - end - end -end - end # module diff --git a/test/Project.toml b/test/Project.toml index 45d66fa4..b65cc55d 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -13,5 +13,5 @@ HOHQMesh = "0.2" Plots = "1" StaticArrays = "1" StructArrays = "0.6" -SummationByPartsOperators = "0.5.52" +SummationByPartsOperators = "0.5" Suppressor = "0.2"