From af812b88c87b144ae6e31447679cb4ac7367898c Mon Sep 17 00:00:00 2001 From: Markus Hauru Date: Fri, 7 Jun 2024 18:21:43 +0200 Subject: [PATCH] Add Aqua to tests (#2257) * Add running Aqua to test suite * Remove undefined imports * Add compat entries for stdlib dependencies See https://discourse.julialang.org/t/psa-compat-requirements-in-the-general-registry-are-changing/104958 for why this is necessary * Disable Aqua checking method ambiguities --- Project.toml | 3 +++ src/Turing.jl | 3 --- src/essential/Essential.jl | 17 ----------------- src/mcmc/Inference.jl | 2 -- test/Aqua.jl | 10 ++++++++++ test/Project.toml | 5 +++++ test/runtests.jl | 4 ++++ 7 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 test/Aqua.jl diff --git a/Project.toml b/Project.toml index 99e7b316b..a870ae9ff 100644 --- a/Project.toml +++ b/Project.toml @@ -68,6 +68,7 @@ Compat = "4.15.0" EllipticalSliceSampling = "0.5, 1, 2" ForwardDiff = "0.10.3" Libtask = "0.7, 0.8" +LinearAlgebra = "1" LogDensityProblems = "2" LogDensityProblemsAD = "1.7.0" MCMCChains = "5, 6" @@ -75,6 +76,8 @@ NamedArrays = "0.9, 0.10" Optimization = "3" OptimizationOptimJL = "0.1, 0.2, 0.3" OrderedCollections = "1" +Printf = "1" +Random = "1" Optim = "1" Reexport = "0.2, 1" Requires = "0.5, 1.0" diff --git a/src/Turing.jl b/src/Turing.jl index e3ba2f81d..8dfb8df28 100644 --- a/src/Turing.jl +++ b/src/Turing.jl @@ -92,8 +92,6 @@ export @model, # modelling SGHMC, HMCDA, NUTS, - DynamicNUTS, - ANUTS, PolynomialStepsize, IS, # particle-based sampling SMC, @@ -121,7 +119,6 @@ export @model, # modelling NamedDist, # Exports from DynamicPPL predict, pointwise_loglikelihoods, - elementwise_loglikelihoods, generated_quantities, logprior, logjoint, diff --git a/src/essential/Essential.jl b/src/essential/Essential.jl index 12413bef2..778e2a62f 100644 --- a/src/essential/Essential.jl +++ b/src/essential/Essential.jl @@ -19,27 +19,10 @@ include("container.jl") export @model, @varname, - generate_observe, - translate_tilde!, - get_vars, - get_data, - get_default_values, - ParticleContainer, - Particle, - Trace, - fork, - forkr, - current_trace, - getweights, - getweight, - effectiveSampleSize, - sweep!, - ResampleWithESSThreshold, AutoForwardDiff, AutoTracker, AutoZygote, AutoReverseDiff, - value, @logprob_str, @prob_str diff --git a/src/mcmc/Inference.jl b/src/mcmc/Inference.jl index 311632a3b..b70426992 100644 --- a/src/mcmc/Inference.jl +++ b/src/mcmc/Inference.jl @@ -38,7 +38,6 @@ import StatsBase: predict export InferenceAlgorithm, Hamiltonian, - GibbsComponent, StaticHamiltonian, AdaptiveHamiltonian, SampleFromUniform, @@ -54,7 +53,6 @@ export InferenceAlgorithm, SGHMC, HMCDA, NUTS, # Hamiltonian-like sampling - DynamicNUTS, IS, SMC, CSMC, diff --git a/test/Aqua.jl b/test/Aqua.jl new file mode 100644 index 000000000..0b536770b --- /dev/null +++ b/test/Aqua.jl @@ -0,0 +1,10 @@ +module AquaTests + +using Aqua: Aqua +using Turing + +# TODO(mhauru) We skip testing for method ambiguities because it catches a lot of problems +# in dependencies. Would like to check it for just Turing.jl itself though. +Aqua.test_all(Turing; ambiguities=false) + +end diff --git a/test/Project.toml b/test/Project.toml index 77df264f5..6515b17b3 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -3,6 +3,7 @@ AbstractMCMC = "80f14c24-f653-4e6a-9b94-39d6b0f70001" AdvancedMH = "5b7e9947-ddc0-4b3f-9b55-0d8042f74170" AdvancedPS = "576499cb-2369-40b2-a588-c64705576edc" AdvancedVI = "b5ca4192-6429-45e5-a2d9-87aec30a685c" +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" Clustering = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" DistributionsAD = "ced4e74d-a319-5a8a-b0ac-84af2272839c" @@ -39,6 +40,7 @@ AbstractMCMC = "5" AdvancedMH = "0.6, 0.7, 0.8" AdvancedPS = "0.6.0" AdvancedVI = "0.2" +Aqua = "0.8" Clustering = "0.14, 0.15" Distributions = "0.25" DistributionsAD = "0.6.3" @@ -47,6 +49,7 @@ DynamicPPL = "0.27" FiniteDifferences = "0.10.8, 0.11, 0.12" ForwardDiff = "0.10.12 - 0.10.32, 0.10" HypothesisTests = "0.11" +LinearAlgebra = "1" LogDensityProblems = "2" LogDensityProblemsAD = "1.4" MCMCChains = "5, 6" @@ -57,6 +60,8 @@ OptimizationBBO = "0.1, 0.2" OptimizationNLopt = "0.1, 0.2" OptimizationOptimJL = "0.1, 0.2, 0.3" PDMats = "0.10, 0.11" +Pkg = "1" +Random = "1" ReverseDiff = "1.4.2" SpecialFunctions = "0.10.3, 1, 2" StableRNGs = "1" diff --git a/test/runtests.jl b/test/runtests.jl index f4f0ca9b3..52205d86e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -26,6 +26,10 @@ macro timeit_include(path::AbstractString) end @testset "Turing" begin + @testset "Aqua" begin + @timeit_include("Aqua.jl") + end + @testset "essential" begin @timeit_include("essential/ad.jl") @timeit_include("essential/container.jl")