Skip to content

Commit 0cb8b4f

Browse files
Update SciMLTesting QA compat to 2.1 (#66)
* Update SciMLTesting QA compat to 2.1 Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> * Keep SciMLTesting QA setup on 2.1 Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> * Fix FiniteStateProjection ModelingToolkit integration Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> * Make telegraph core test deterministic Seed the telegraph model test before drawing random parameters so tight analytic comparisons do not depend on CI RNG draws. Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> * Add Random to test dependencies Co-Authored-By: Chris Rackauckas <accounts@chrisrackauckas.com> --------- Co-authored-by: ChrisRackauckas-Claude <accounts@chrisrackauckas.com>
1 parent 5040f82 commit 0cb8b4f

8 files changed

Lines changed: 38 additions & 19 deletions

File tree

Project.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ version = "0.3.5"
77
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"
88
DiffEqBase = "2b5f629d-d688-5b77-993f-72d75c75574e"
99
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
10+
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
1011
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
1112
RuntimeGeneratedFunctions = "7e49a35a-f44a-4d26-94aa-eba1b4ca6b47"
1213
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
@@ -17,11 +18,13 @@ DiffEqBase = "6.165, 7"
1718
Distributions = "0.25"
1819
LinearAlgebra = "1"
1920
MacroTools = "^0.5.5"
21+
ModelingToolkit = "9, 10, 11"
2022
OrdinaryDiffEq = "6, 7"
23+
Random = "1"
2124
Reexport = "1.2.2"
2225
RuntimeGeneratedFunctions = "0.5"
2326
SafeTestsets = "0.1, 1"
24-
SciMLTesting = "1"
27+
SciMLTesting = "2.1"
2528
SparseArrays = "1"
2629
SteadyStateDiffEq = "2.5"
2730
Sundials = "4, 5, 6"
@@ -32,11 +35,12 @@ julia = "1.10"
3235
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
3336
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3437
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
38+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
3539
SafeTestsets = "1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
3640
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
3741
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
3842
Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4"
3943
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
4044

4145
[targets]
42-
test = ["Distributions", "LinearAlgebra", "OrdinaryDiffEq", "SafeTestsets", "SciMLTesting", "SteadyStateDiffEq", "Sundials", "Test"]
46+
test = ["Distributions", "LinearAlgebra", "OrdinaryDiffEq", "Random", "SafeTestsets", "SciMLTesting", "SteadyStateDiffEq", "Sundials", "Test"]

src/FiniteStateProjection.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Reexport
44
@reexport using Catalyst
55

66
using MacroTools
7+
import ModelingToolkit
78
using SparseArrays
89
using DiffEqBase
910

src/build_rhs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ the work in the package happens; for best performance it is suggested to build a
131131
once for a given reaction system and reuse it instead of directly converting
132132
a reaction system to an `ODEProblem` (which implicitly calls this function).
133133
"""
134-
Base.convert(::Type{ODEFunction}, sys::FSPSystem) = ODEFunction{true}(build_rhs(sys))
134+
Base.convert(::Type{ODEFunction}, sys::FSPSystem) = ODEFunction{true, SciMLBase.FullSpecialize}(build_rhs(sys))
135135

136136
"""
137137
DiffEqBase.ODEProblem(sys::FSPSystem, u0, tmax[, p])

src/build_rhs_ss.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Return an `ODEFunction` defining the right-hand side of the CME, for use
8282
with `SteadyStateProblem`s.
8383
"""
8484
function Base.convert(::Type{ODEFunction}, sys::FSPSystem, ::SteadyState)
85-
return ODEFunction{true}(build_rhs_ss(sys))
85+
return ODEFunction{true, SciMLBase.FullSpecialize}(build_rhs_ss(sys))
8686
end
8787

8888
"""

src/fspsystem.jl

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,11 @@ function compile_ratefunc(ex_rf, params)
6565
return @RuntimeGeneratedFunction(ex)
6666
end
6767

68+
_parameter_symbol(key::Symbol) = key
69+
_parameter_symbol(key) = Symbol(ModelingToolkit.value(key))
70+
6871
function pmap_to_p(sys::FSPSystem, pmap)
69-
pmap_conv = eltype(pmap) <: Pair{Symbol} ? Catalyst.symmap_to_varmap(sys.rs, pmap) :
70-
pmap
71-
return ModelingToolkit.varmap_to_vars(pmap_conv, Catalyst.parameters(sys.rs))
72+
pmap isa SciMLBase.NullParameters && return pmap
73+
values_by_parameter = Dict(_parameter_symbol(k) => v for (k, v) in pmap)
74+
return [values_by_parameter[p] for p in Symbol.(Catalyst.parameters(sys.rs))]
7275
end

test/qa/Project.toml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@ JET = "c3a54625-cd67-489e-a8e7-0a5a0ff4e31b"
44
SciMLTesting = "09d9d899-5365-40a9-917a-5f67fddea283"
55
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
66

7-
[sources]
8-
FiniteStateProjection = { path = "../.." }
9-
107
[compat]
118
JET = "0.9,0.10,0.11"
12-
SciMLTesting = "1.7"
9+
SciMLTesting = "2.1"
1310
Test = "1"
1411
julia = "1.10"

test/qa/qa.jl

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
using SciMLTesting, FiniteStateProjection, Test
22
using JET
33

4+
const CATALYST_REEXPORTS = Tuple(intersect(names(FiniteStateProjection), names(FiniteStateProjection.Catalyst)))
5+
const API_DOCS_IGNORE = Tuple(
6+
unique(
7+
(
8+
:SymbolicUtils,
9+
:NaiveIndexHandler,
10+
CATALYST_REEXPORTS...,
11+
)
12+
)
13+
)
14+
415
run_qa(
516
FiniteStateProjection;
617
explicit_imports = true,
@@ -24,13 +35,9 @@ run_qa(
2435
:value, # owner Symbolics, accessed via ModelingToolkit
2536
),
2637
),
27-
# `Catalyst = "15"` pins the SciMLBase 2.x / ModelingToolkit 9.x / Symbolics 6.x
28-
# ecosystem, so the public-API releases (SciMLBase 3.27 / MTK 11 / Symbolics 7)
29-
# are NOT resolvable here. Verified on Julia 1.12 against the resolved stack
30-
# (Catalyst 15.0.11, ModelingToolkit 9.84.0, Symbolics 6.58.0, SciMLBase 2.153.1):
31-
# each of these names is still non-public in its owner at the resolvable version,
32-
# and MacroTools/Catalyst have not declared theirs public. Drop each as its owner
33-
# ships a public declaration that FiniteStateProjection can actually resolve.
38+
# These names are still non-public in their resolvable owners, or are
39+
# re-exported from a non-owner. Drop each ignore as its owner ships a public
40+
# declaration that FiniteStateProjection can actually resolve.
3441
all_qualified_accesses_are_public = (;
3542
ignore = (
3643
:_symbol_to_var, # Catalyst (non-public)
@@ -42,11 +49,16 @@ run_qa(
4249
:striplines, # MacroTools (non-public)
4350
:scalarize, # ModelingToolkit (owner Symbolics; still non-public)
4451
:value, # ModelingToolkit (owner Symbolics; still non-public)
45-
:varmap_to_vars, # ModelingToolkit (non-public)
4652
:NullParameters, # SciMLBase (public in 3.30+, but Catalyst 15 pins 2.153.1 where it is not)
4753
),
4854
),
4955
),
56+
api_docs_kwargs = (;
57+
# `@reexport using Catalyst` intentionally exposes Catalyst's symbolic
58+
# stack. Require docstrings for FiniteStateProjection-owned public API
59+
# here, and leave dependency API docs to their owner packages.
60+
ignore = API_DOCS_IGNORE,
61+
),
5062
# Heavy `@reexport using Catalyst` plus the symbolic stack make ~23 names
5163
# implicit; making them all explicit is a risky mass refactor. Tracked in #60.
5264
ei_broken = (:no_implicit_imports,),

test/telegraph.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ using FiniteStateProjection
66
using SparseArrays
77
using LinearAlgebra
88
using Sundials
9+
using Random
910

1011
marg(vec; dims) = dropdims(sum(vec; dims); dims)
12+
Random.seed!(100)
1113

1214
rs = @reaction_network begin
1315
σ_on * (1 - G), 0 --> G

0 commit comments

Comments
 (0)