Skip to content

Commit

Permalink
Add Aqua to tests (#2257)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mhauru authored Jun 7, 2024
1 parent f6d1712 commit af812b8
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 22 deletions.
3 changes: 3 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,16 @@ 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"
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"
Expand Down
3 changes: 0 additions & 3 deletions src/Turing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@ export @model, # modelling
SGHMC,
HMCDA,
NUTS,
DynamicNUTS,
ANUTS,
PolynomialStepsize,
IS, # particle-based sampling
SMC,
Expand Down Expand Up @@ -121,7 +119,6 @@ export @model, # modelling
NamedDist, # Exports from DynamicPPL
predict,
pointwise_loglikelihoods,
elementwise_loglikelihoods,
generated_quantities,
logprior,
logjoint,
Expand Down
17 changes: 0 additions & 17 deletions src/essential/Essential.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/mcmc/Inference.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import StatsBase: predict

export InferenceAlgorithm,
Hamiltonian,
GibbsComponent,
StaticHamiltonian,
AdaptiveHamiltonian,
SampleFromUniform,
Expand All @@ -54,7 +53,6 @@ export InferenceAlgorithm,
SGHMC,
HMCDA,
NUTS, # Hamiltonian-like sampling
DynamicNUTS,
IS,
SMC,
CSMC,
Expand Down
10 changes: 10 additions & 0 deletions test/Aqua.jl
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit af812b8

Please sign in to comment.