From 8fdf3b1233cfb67ccf60294270ba916d234e4e06 Mon Sep 17 00:00:00 2001 From: Chris Rackauckas Date: Thu, 25 Jun 2026 08:49:59 -0400 Subject: [PATCH] QA: run_qa v1.6 form + ExplicitImports Convert the hand-rolled Aqua + JET QA suite to run_qa with explicit_imports = true, and curate per-check ExplicitImports ignore lists for the external non-public / re-exported names the package genuinely uses (Symbolics unwrap/wrap/shape/Arr/VariableDefaultValue/ option_to_metadata_type, Lux/LuxCore initialparameters/outputsize/ stateless_apply, ModelingToolkitBase t_nounits). The via_owners entries cover the SymbolicUtils->Symbolics and LuxCore->Lux re-export owner mismatches; the are_public entries are no-ops on Julia 1.11+ (where those names are declared public) and only apply on the LTS (1.10) lane. Co-Authored-By: Chris Rackauckas --- Project.toml | 2 +- src/ModelingToolkitNeuralNets.jl | 4 +-- test/qa/qa.jl | 55 ++++++++++++++++++++++---------- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/Project.toml b/Project.toml index 09efecf..6ace2d1 100644 --- a/Project.toml +++ b/Project.toml @@ -32,7 +32,7 @@ Random = "1.10" SafeTestsets = "0.1" SciCompDSL = "1" SciMLSensitivity = "7.93" -SciMLTesting = "1" +SciMLTesting = "1.6" SciMLStructures = "1.10" StableRNGs = "1" Statistics = "1.10" diff --git a/src/ModelingToolkitNeuralNets.jl b/src/ModelingToolkitNeuralNets.jl index 8296d0e..77c6b92 100644 --- a/src/ModelingToolkitNeuralNets.jl +++ b/src/ModelingToolkitNeuralNets.jl @@ -1,8 +1,8 @@ module ModelingToolkitNeuralNets -using ModelingToolkitBase: @parameters, @named, @variables, System, t_nounits, getmetadata, hasmetadata +using ModelingToolkitBase: @parameters, @variables, System, t_nounits, getmetadata using IntervalSets: var".." -using Symbolics: Symbolics, @register_array_symbolic, @wrapped, unwrap, wrap, shape +using Symbolics: Symbolics, unwrap, wrap, shape using LuxCore: stateless_apply, outputsize using Lux: Lux using Random: Xoshiro diff --git a/test/qa/qa.jl b/test/qa/qa.jl index f7126db..0100bc5 100644 --- a/test/qa/qa.jl +++ b/test/qa/qa.jl @@ -1,19 +1,40 @@ -using Test -using ModelingToolkitNeuralNets -using Aqua +using SciMLTesting, ModelingToolkitNeuralNets, Test using JET -@testset verbose = true "Code quality (Aqua.jl)" begin - Aqua.find_persistent_tasks_deps(ModelingToolkitNeuralNets) - Aqua.test_ambiguities(ModelingToolkitNeuralNets, recursive = false) - Aqua.test_deps_compat(ModelingToolkitNeuralNets) - Aqua.test_piracies(ModelingToolkitNeuralNets) - Aqua.test_project_extras(ModelingToolkitNeuralNets) - Aqua.test_stale_deps(ModelingToolkitNeuralNets, ignore = Symbol[]) - Aqua.test_unbound_args(ModelingToolkitNeuralNets) - Aqua.test_undefined_exports(ModelingToolkitNeuralNets) -end - -@testset "Code linting (JET.jl)" begin - JET.test_package(ModelingToolkitNeuralNets; target_defined_modules = true) -end +run_qa( + ModelingToolkitNeuralNets; + explicit_imports = true, + ei_kwargs = (; + # `unwrap`/`shape` are re-exported by Symbolics but owned by SymbolicUtils; + # `initialparameters` is re-exported by Lux but owned by LuxCore. We use + # the re-exporting package deliberately (matching the rest of the SciML + # convention of going through Symbolics / Lux), so ignore the owner + # mismatch until the names are re-declared public in the re-exporter. + all_explicit_imports_via_owners = (; + ignore = (:shape, :unwrap), # owner SymbolicUtils, from Symbolics + ), + all_qualified_accesses_via_owners = (; + ignore = ( + :initialparameters, # owner LuxCore, accessed via Lux + :unwrap, # owner SymbolicUtils, accessed via Symbolics + ), + ), + # Non-public external names the package genuinely relies on. These are + # public (via the `public` keyword) on Julia 1.11+, so these ignores are + # no-ops there and only matter on the LTS (1.10) lane; drop each entry + # once its owner marks it public on the supported floor. + all_qualified_accesses_are_public = (; + ignore = ( + :Arr, :VariableDefaultValue, :option_to_metadata_type, :unwrap, # Symbolics + :initialparameters, # Lux + ), + ), + all_explicit_imports_are_public = (; + ignore = ( + :shape, :unwrap, :wrap, # Symbolics + :outputsize, :stateless_apply, # LuxCore + :t_nounits, # ModelingToolkitBase + ), + ), + ), +)