From b172a4c1345b2c41a4c6356da5a96fb46577c15b Mon Sep 17 00:00:00 2001 From: Adrian Hill Date: Wed, 9 Oct 2024 17:07:43 +0200 Subject: [PATCH] Drop compatibility with Julia versions below LTS (#204) * Simplify package extensions * Remove version conditionals for Julia <1.10 --- .github/workflows/CI.yml | 5 - Project.toml | 13 +- ...ConnectivityTracerDataInterpolationsExt.jl | 54 +++---- ...rseConnectivityTracerLogExpFunctionsExt.jl | 84 ++++------- ext/SparseConnectivityTracerNNlibExt.jl | 81 ++++------ ext/SparseConnectivityTracerNaNMathExt.jl | 9 +- ...seConnectivityTracerSpecialFunctionsExt.jl | 141 ++++++------------ src/SparseConnectivityTracer.jl | 22 --- test/linting.jl | 1 - test/test_arrays.jl | 19 +-- 10 files changed, 127 insertions(+), 302 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index fb93af3..5573dc2 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -30,11 +30,6 @@ jobs: - Core - Benchmarks - NLPModels - exclude: # TODO: remove once LTS is not 1.6 - - version: 'lts' - group: NLPModels - - version: 'lts' - group: Benchmarks steps: - uses: actions/checkout@v4 - uses: julia-actions/setup-julia@v2 diff --git a/Project.toml b/Project.toml index 2c20b86..a2f0868 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SparseConnectivityTracer" uuid = "9f842d2f-2579-4b1d-911e-f412cf18a3f5" authors = ["Adrian Hill "] -version = "0.6.6" +version = "0.6.7-DEV" [deps] ADTypes = "47edcb42-4c32-4615-8424-f2b9edc5f35b" @@ -9,7 +9,6 @@ DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae" FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" -Requires = "ae029012-a4dd-5104-9daa-d747884805df" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [weakdeps] @@ -36,14 +35,6 @@ LogExpFunctions = "0.3.28" NNlib = "0.8, 0.9" NaNMath = "1" Random = "<0.0.1, 1" -Requires = "1.3" SparseArrays = "<0.0.1, 1" SpecialFunctions = "2.4" -julia = "1.6" - -[extras] -DataInterpolations = "82cc6244-b520-54b8-b5a6-8a565e85f1d0" -LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" -NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" -SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" +julia = "1.10" diff --git a/ext/SparseConnectivityTracerDataInterpolationsExt.jl b/ext/SparseConnectivityTracerDataInterpolationsExt.jl index aaa2cb9..bbf4446 100644 --- a/ext/SparseConnectivityTracerDataInterpolationsExt.jl +++ b/ext/SparseConnectivityTracerDataInterpolationsExt.jl @@ -2,43 +2,23 @@ # copy another, less complicated one! module SparseConnectivityTracerDataInterpolationsExt -if isdefined(Base, :get_extension) - using SparseConnectivityTracer: AbstractTracer, Dual, primal, tracer - using SparseConnectivityTracer: GradientTracer, gradient_tracer_1_to_1 - using SparseConnectivityTracer: HessianTracer, hessian_tracer_1_to_1 - using FillArrays: Fill # from FillArrays.jl - import DataInterpolations: - LinearInterpolation, - QuadraticInterpolation, - LagrangeInterpolation, - AkimaInterpolation, - ConstantInterpolation, - QuadraticSpline, - CubicSpline, - BSplineInterpolation, - BSplineApprox, - CubicHermiteSpline, - # PCHIPInterpolation, - QuinticHermiteSpline -else - using ..SparseConnectivityTracer: AbstractTracer, Dual, primal, tracer - using ..SparseConnectivityTracer: GradientTracer, gradient_tracer_1_to_1 - using ..SparseConnectivityTracer: HessianTracer, hessian_tracer_1_to_1 - using ..FillArrays: Fill # from FillArrays.jl - import ..DataInterpolations: - LinearInterpolation, - QuadraticInterpolation, - LagrangeInterpolation, - AkimaInterpolation, - ConstantInterpolation, - QuadraticSpline, - CubicSpline, - BSplineInterpolation, - BSplineApprox, - CubicHermiteSpline, - # PCHIPInterpolation, - QuinticHermiteSpline -end +using SparseConnectivityTracer: AbstractTracer, Dual, primal, tracer +using SparseConnectivityTracer: GradientTracer, gradient_tracer_1_to_1 +using SparseConnectivityTracer: HessianTracer, hessian_tracer_1_to_1 +using FillArrays: Fill # from FillArrays.jl +import DataInterpolations: + LinearInterpolation, + QuadraticInterpolation, + LagrangeInterpolation, + AkimaInterpolation, + ConstantInterpolation, + QuadraticSpline, + CubicSpline, + BSplineInterpolation, + BSplineApprox, + CubicHermiteSpline, + # PCHIPInterpolation, + QuinticHermiteSpline #========================# # General interpolations # diff --git a/ext/SparseConnectivityTracerLogExpFunctionsExt.jl b/ext/SparseConnectivityTracerLogExpFunctionsExt.jl index e079803..57d6247 100644 --- a/ext/SparseConnectivityTracerLogExpFunctionsExt.jl +++ b/ext/SparseConnectivityTracerLogExpFunctionsExt.jl @@ -1,62 +1,32 @@ module SparseConnectivityTracerLogExpFunctionsExt -if isdefined(Base, :get_extension) - import SparseConnectivityTracer as SCT - using LogExpFunctions: - LogExpFunctions, - cexpexp, - cloglog, - log1mexp, - log1mlogistic, - log1pexp, - log1pmx, - log1psq, - log2mexp, - logabssinh, - logaddexp, - logcosh, - logexpm1, - logistic, - logit, - logit1mexp, - logitexp, - loglogistic, - logmxp1, - logsubexp, - xexpx, - xexpy, - xlog1py, - xlogx, - xlogy -else - import ..SparseConnectivityTracer as SCT - using ..LogExpFunctions: - LogExpFunctions, - cexpexp, - cloglog, - log1mexp, - log1mlogistic, - log1pexp, - log1pmx, - log1psq, - log2mexp, - logabssinh, - logaddexp, - logcosh, - logexpm1, - logistic, - logit, - logit1mexp, - logitexp, - loglogistic, - logmxp1, - logsubexp, - xexpx, - xexpy, - xlog1py, - xlogx, - xlogy -end +import SparseConnectivityTracer as SCT +using LogExpFunctions: + LogExpFunctions, + cexpexp, + cloglog, + log1mexp, + log1mlogistic, + log1pexp, + log1pmx, + log1psq, + log2mexp, + logabssinh, + logaddexp, + logcosh, + logexpm1, + logistic, + logit, + logit1mexp, + logitexp, + loglogistic, + logmxp1, + logsubexp, + xexpx, + xexpy, + xlog1py, + xlogx, + xlogy ## 1-to-1 functions diff --git a/ext/SparseConnectivityTracerNNlibExt.jl b/ext/SparseConnectivityTracerNNlibExt.jl index b9a8a43..0edef0e 100644 --- a/ext/SparseConnectivityTracerNNlibExt.jl +++ b/ext/SparseConnectivityTracerNNlibExt.jl @@ -2,61 +2,32 @@ # Parametric activation functions with two or more arguments are ignored. module SparseConnectivityTracerNNlibExt -if isdefined(Base, :get_extension) - import SparseConnectivityTracer as SCT - using NNlib: - NNlib, - celu, - elu, - gelu, - hardswish, - hardtanh, - hardσ, - leakyrelu, - lisht, - logcosh, - logσ, - mish, - relu, - relu6, - selu, - sigmoid_fast, - softplus, - softshrink, - softsign, - swish, - tanh_fast, - tanhshrink, - trelu, - σ -else - import ..SparseConnectivityTracer as SCT - using ..NNlib: - NNlib, - celu, - elu, - gelu, - hardswish, - hardtanh, - hardσ, - leakyrelu, - lisht, - logcosh, - logσ, - mish, - relu, - relu6, - selu, - sigmoid_fast, - softplus, - softshrink, - softsign, - swish, - tanh_fast, - tanhshrink, - trelu, - σ -end +import SparseConnectivityTracer as SCT +using NNlib: + NNlib, + celu, + elu, + gelu, + hardswish, + hardtanh, + hardσ, + leakyrelu, + lisht, + logcosh, + logσ, + mish, + relu, + relu6, + selu, + sigmoid_fast, + softplus, + softshrink, + softsign, + swish, + tanh_fast, + tanhshrink, + trelu, + σ ## 1-to-1 diff --git a/ext/SparseConnectivityTracerNaNMathExt.jl b/ext/SparseConnectivityTracerNaNMathExt.jl index 9502fca..6daf89c 100644 --- a/ext/SparseConnectivityTracerNaNMathExt.jl +++ b/ext/SparseConnectivityTracerNaNMathExt.jl @@ -1,12 +1,7 @@ module SparseConnectivityTracerNaNMathExt -if isdefined(Base, :get_extension) - import SparseConnectivityTracer as SCT - using NaNMath: NaNMath -else - import ..SparseConnectivityTracer as SCT - using ..NaNMath: NaNMath -end +import SparseConnectivityTracer as SCT +using NaNMath: NaNMath ## 1-to-1 diff --git a/ext/SparseConnectivityTracerSpecialFunctionsExt.jl b/ext/SparseConnectivityTracerSpecialFunctionsExt.jl index 42a7d81..2bdc084 100644 --- a/ext/SparseConnectivityTracerSpecialFunctionsExt.jl +++ b/ext/SparseConnectivityTracerSpecialFunctionsExt.jl @@ -1,100 +1,51 @@ module SparseConnectivityTracerSpecialFunctionsExt -if isdefined(Base, :get_extension) - import SparseConnectivityTracer as SCT - using SpecialFunctions: - SpecialFunctions, - airyai, - airyaiprime, - airyaiprimex, - airyaix, - airybi, - airybiprime, - airybiprimex, - airybix, - besseli, - besselix, - besselj, - besselj0, - besselj1, - besseljx, - besselk, - besselkx, - bessely, - bessely0, - bessely1, - besselyx, - beta, - cosint, - digamma, - ellipe, - ellipk, - erf, - erfc, - erfcinv, - erfcx, - erfinv, - expint, - expinti, - expintx, - gamma, - invdigamma, - jinc, - logbeta, - logerfc, - loggamma, - sinint, - sphericalbesselj, - sphericalbessely, - trigamma -else - import ..SparseConnectivityTracer as SCT - using ..SpecialFunctions: - SpecialFunctions, - airyai, - airyaiprime, - airyaiprimex, - airyaix, - airybi, - airybiprime, - airybiprimex, - airybix, - besseli, - besselix, - besselj, - besselj0, - besselj1, - besseljx, - besselk, - besselkx, - bessely, - bessely0, - bessely1, - besselyx, - beta, - cosint, - digamma, - ellipe, - ellipk, - erf, - erfc, - erfcinv, - erfcx, - erfinv, - expint, - expinti, - expintx, - gamma, - invdigamma, - jinc, - logbeta, - logerfc, - loggamma, - sinint, - sphericalbesselj, - sphericalbessely, - trigamma -end +import SparseConnectivityTracer as SCT +using SpecialFunctions: + SpecialFunctions, + airyai, + airyaiprime, + airyaiprimex, + airyaix, + airybi, + airybiprime, + airybiprimex, + airybix, + besseli, + besselix, + besselj, + besselj0, + besselj1, + besseljx, + besselk, + besselkx, + bessely, + bessely0, + bessely1, + besselyx, + beta, + cosint, + digamma, + ellipe, + ellipk, + erf, + erfc, + erfcinv, + erfcx, + erfinv, + expint, + expinti, + expintx, + gamma, + invdigamma, + jinc, + logbeta, + logerfc, + loggamma, + sinint, + sphericalbesselj, + sphericalbessely, + trigamma #= Complex functions are ignored. diff --git a/src/SparseConnectivityTracer.jl b/src/SparseConnectivityTracer.jl index b507da6..dfa0d7c 100644 --- a/src/SparseConnectivityTracer.jl +++ b/src/SparseConnectivityTracer.jl @@ -11,10 +11,6 @@ using FillArrays: Fill using DocStringExtensions: DocStringExtensions, TYPEDEF, TYPEDFIELDS -if !isdefined(Base, :get_extension) - using Requires -end - include("settypes/duplicatevector.jl") include("settypes/recursiveset.jl") include("settypes/sortedvector.jl") @@ -42,22 +38,4 @@ export TracerLocalSparsityDetector # Reexport ADTypes interface export jacobian_sparsity, hessian_sparsity -function __init__() - @static if !isdefined(Base, :get_extension) - @require LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688" include( - "../ext/SparseConnectivityTracerLogExpFunctionsExt.jl" - ) - @require NaNMath = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3" include( - "../ext/SparseConnectivityTracerNaNMathExt.jl" - ) - @require NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" include( - "../ext/SparseConnectivityTracerNNlibExt.jl" - ) - @require SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" include( - "../ext/SparseConnectivityTracerSpecialFunctionsExt.jl" - ) - # NOTE: DataInterpolations extension is not loaded on Julia <1.10 - end -end - end # module diff --git a/test/linting.jl b/test/linting.jl index 4ae6a26..cc0d951 100644 --- a/test/linting.jl +++ b/test/linting.jl @@ -23,7 +23,6 @@ end SparseConnectivityTracer; ambiguities=false, deps_compat=(check_extras=false,), - stale_deps=(ignore=[:Requires],), persistent_tasks=false, ) end diff --git a/test/test_arrays.jl b/test/test_arrays.jl index 3f069d8..095f304 100644 --- a/test/test_arrays.jl +++ b/test/test_arrays.jl @@ -311,14 +311,11 @@ end testJ1(SpdiagmifyInput(exp), v) testH1(SpdiagmifyInput(exp), v) - if VERSION >= v"1.10" - # issue with custom _mapreducezeros in SparseArrays on Julia 1.6 - testJ0(SpdiagmifyInput(pow0), v) - testH0(SpdiagmifyInput(pow0), v) + testJ0(SpdiagmifyInput(pow0), v) + testH0(SpdiagmifyInput(pow0), v) - testJ1(SpdiagmifyInput(pow3), v) - testH1(SpdiagmifyInput(pow3), v) - end + testJ1(SpdiagmifyInput(pow3), v) + testH1(SpdiagmifyInput(pow3), v) end end @@ -327,11 +324,9 @@ end testJ1(pinv, A) testH1(pinv, A) end - if VERSION >= v"1.9" - @testset "`SparseMatrixCSC` (3×4)" begin - testJ1(SparsifyInput(pinv), rand(3, 4)) - testH1(SparsifyInput(pinv), rand(3, 4)) - end + @testset "`SparseMatrixCSC` (3×4)" begin + testJ1(SparsifyInput(pinv), rand(3, 4)) + testH1(SparsifyInput(pinv), rand(3, 4)) end end