Skip to content

Commit 61d9156

Browse files
Merge pull request #784 from SciML/depwarn
fix a bunch of depwarns
2 parents b12c854 + 1ca3b3a commit 61d9156

File tree

4 files changed

+84
-32
lines changed

4 files changed

+84
-32
lines changed

.github/workflows/Downstream.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: IntegrationTest
2+
on:
3+
push:
4+
branches: [master]
5+
tags: [v*]
6+
pull_request:
7+
8+
jobs:
9+
test:
10+
name: ${{ matrix.package.repo }}/${{ matrix.package.group }}
11+
runs-on: ${{ matrix.os }}
12+
env:
13+
GROUP: ${{ matrix.package.group }}
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
julia-version: [1]
18+
os: [ubuntu-latest]
19+
package:
20+
- {user: SciML, repo: Catalyst.jl, group: All}
21+
22+
steps:
23+
- uses: actions/checkout@v2
24+
- uses: julia-actions/setup-julia@v1
25+
with:
26+
version: ${{ matrix.julia-version }}
27+
arch: x64
28+
- uses: julia-actions/julia-buildpkg@latest
29+
- name: Clone Downstream
30+
uses: actions/checkout@v2
31+
with:
32+
repository: ${{ matrix.package.user }}/${{ matrix.package.repo }}
33+
path: downstream
34+
- name: Load this and run the downstream tests
35+
shell: julia --color=yes --project=downstream {0}
36+
run: |
37+
using Pkg
38+
try
39+
# force it to use this PR's version of the package
40+
Pkg.develop(PackageSpec(path=".")) # resolver may fail with main deps
41+
Pkg.update()
42+
Pkg.test() # resolver may fail with test time deps
43+
catch err
44+
err isa Pkg.Resolve.ResolverError || rethrow()
45+
# If we can't resolve that means this is incompatible by SemVer and this is fine
46+
# It means we marked this as a breaking change, so we don't need to worry about
47+
# Mistakenly introducing a breaking change, as we have intentionally made one
48+
@info "Not compatible with this release. No problem." exception=err
49+
exit(0) # Exit immediately, as a success
50+
end

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "5.6.0"
4+
version = "5.6.1"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"

src/systems/diffeqs/abstractodesystem.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function calculate_tgrad(sys::AbstractODESystem;
66
# have `u(t) * t` we want to have the tgrad to be `u(t)` instead of `u'(t) *
77
# t + u(t)`.
88
rhs = [detime_dvs(eq.rhs) for eq equations(sys)]
9-
iv = sys.iv
9+
iv = get_iv(sys)
1010
xs = states(sys)
1111
rule = Dict(map((x, xt) -> xt=>x, detime_dvs.(xs), xs))
1212
rhs = substitute.(rhs, Ref(rule))
@@ -22,7 +22,7 @@ function calculate_jacobian(sys::AbstractODESystem;
2222
isempty(sys.jac[]) || return sys.jac[] # use cached Jacobian, if possible
2323
rhs = [eq.rhs for eq equations(sys)]
2424

25-
iv = sys.iv
25+
iv = get_iv(sys)
2626
dvs = states(sys)
2727

2828
if sparse
@@ -38,13 +38,13 @@ end
3838
function generate_tgrad(sys::AbstractODESystem, dvs = states(sys), ps = parameters(sys);
3939
simplify=false, kwargs...)
4040
tgrad = calculate_tgrad(sys,simplify=simplify)
41-
return build_function(tgrad, dvs, ps, sys.iv; kwargs...)
41+
return build_function(tgrad, dvs, ps, get_iv(sys); kwargs...)
4242
end
4343

4444
function generate_jacobian(sys::AbstractODESystem, dvs = states(sys), ps = parameters(sys);
4545
simplify=false, sparse = false, kwargs...)
4646
jac = calculate_jacobian(sys;simplify=simplify,sparse=sparse)
47-
return build_function(jac, dvs, ps, sys.iv; kwargs...)
47+
return build_function(jac, dvs, ps, get_iv(sys); kwargs...)
4848
end
4949

5050
function generate_function(sys::AbstractODESystem, dvs = states(sys), ps = parameters(sys); kwargs...)
@@ -61,7 +61,7 @@ function generate_function(sys::AbstractODESystem, dvs = states(sys), ps = param
6161
return build_function(rhss,
6262
map(x->time_varying_as_func(value(x), sys), dvs),
6363
map(x->time_varying_as_func(value(x), sys), ps),
64-
sys.iv; kwargs...)
64+
get_iv(sys); kwargs...)
6565
end
6666

6767
function time_varying_as_func(x, sys)
@@ -244,7 +244,7 @@ function process_DEProblem(constructor, sys::AbstractODESystem,u0map,parammap;
244244
kwargs...)
245245
dvs = states(sys)
246246
ps = parameters(sys)
247-
u0map′ = lower_mapnames(u0map,sys.iv)
247+
u0map′ = lower_mapnames(u0map,get_iv(sys))
248248
u0 = varmap_to_vars(u0map′,dvs; defaults=default_u0(sys))
249249

250250
if !(parammap isa DiffEqBase.NullParameters)

src/systems/reaction/reactionsystem.jl

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,11 @@ function oderatelaw(rx; combinatoric_ratelaw=true)
187187
end
188188

189189
function assemble_oderhs(rs; combinatoric_ratelaws=true)
190-
species_to_idx = Dict((x => i for (i,x) in enumerate(rs.states)))
191-
rhsvec = Any[0 for i in eachindex(rs.states)]
190+
sts = states(rs)
191+
species_to_idx = Dict((x => i for (i,x) in enumerate(sts)))
192+
rhsvec = Any[0 for i in eachindex(sts)]
192193

193-
for rx in rs.eqs
194+
for rx in equations(rs)
194195
rl = oderatelaw(rx; combinatoric_ratelaw=combinatoric_ratelaws)
195196
for (spec,stoich) in rx.netstoich
196197
i = species_to_idx[spec]
@@ -210,20 +211,21 @@ end
210211
function assemble_drift(rs; combinatoric_ratelaws=true, as_odes=true)
211212
rhsvec = assemble_oderhs(rs; combinatoric_ratelaws=combinatoric_ratelaws)
212213
if as_odes
213-
D = Differential(rs.iv)
214-
eqs = [Equation(D(x),rhs) for (x,rhs) in zip(rs.states,rhsvec)]
214+
D = Differential(get_iv(rs))
215+
eqs = [Equation(D(x),rhs) for (x,rhs) in zip(states(rs),rhsvec)]
215216
else
216217
eqs = [Equation(0,rhs) for rhs in rhsvec]
217218
end
218219
eqs
219220
end
220221

221222
function assemble_diffusion(rs, noise_scaling; combinatoric_ratelaws=true)
222-
eqs = Matrix{Any}(undef, length(rs.states), length(rs.eqs))
223+
sts = states(rs)
224+
eqs = Matrix{Any}(undef, length(sts), length(equations(rs)))
223225
eqs .= 0
224-
species_to_idx = Dict((x => i for (i,x) in enumerate(rs.states)))
226+
species_to_idx = Dict((x => i for (i,x) in enumerate(sts)))
225227

226-
for (j,rx) in enumerate(rs.eqs)
228+
for (j,rx) in enumerate(equations(rs))
227229
rlsqrt = sqrt(abs(oderatelaw(rx; combinatoric_ratelaw=combinatoric_ratelaws)))
228230
(noise_scaling!==nothing) && (rlsqrt *= noise_scaling[j])
229231
for (spec,stoich) in rx.netstoich
@@ -283,7 +285,7 @@ end
283285
"""
284286
```julia
285287
ismassaction(rx, rs; rxvars = get_variables(rx.rate),
286-
haveivdep = any(var -> isequal(rs.iv,var), rxvars),
288+
haveivdep = any(var -> isequal(get_iv(rs),var), rxvars),
287289
stateset = Set(states(rs)))
288290
```
289291
@@ -299,7 +301,7 @@ explicitly on the independent variable (usually time).
299301
- Optional: `stateset`, set of states which if the rxvars are within mean rx is non-mass action.
300302
"""
301303
function ismassaction(rx, rs; rxvars = get_variables(rx.rate),
302-
haveivdep = any(var -> isequal(rs.iv,var), rxvars),
304+
haveivdep = any(var -> isequal(get_iv(rs),var), rxvars),
303305
stateset = Set(states(rs)))
304306
# if no dependencies must be zero order
305307
(length(rxvars)==0) && return true
@@ -332,15 +334,15 @@ function assemble_jumps(rs; combinatoric_ratelaws=true)
332334
stateset = Set(states(rs))
333335
#rates = []; rstoich = []; nstoich = []
334336
rxvars = []
335-
ivname = rs.iv.name
337+
ivname = nameof(get_iv(rs))
336338

337339
isempty(equations(rs)) && error("Must give at least one reaction before constructing a JumpSystem.")
338340
for rx in equations(rs)
339341
empty!(rxvars)
340342
(rx.rate isa Symbolic) && get_variables!(rxvars, rx.rate)
341343
haveivdep = false
342344
@inbounds for i = 1:length(rxvars)
343-
if isequal(rxvars[i], rs.iv)
345+
if isequal(rxvars[i], get_iv(rs))
344346
haveivdep = true
345347
break
346348
end
@@ -378,8 +380,8 @@ ignored.
378380
"""
379381
function Base.convert(::Type{<:ODESystem}, rs::ReactionSystem; combinatoric_ratelaws=true)
380382
eqs = assemble_drift(rs; combinatoric_ratelaws=combinatoric_ratelaws)
381-
ODESystem(eqs,rs.iv,rs.states,rs.ps,name=rs.name,
382-
systems=convert.(ODESystem,rs.systems))
383+
ODESystem(eqs,get_iv(rs),states(rs),get_ps(rs),name=nameof(rs),
384+
systems=convert.(ODESystem,get_systems(rs)))
383385
end
384386

385387
"""
@@ -397,7 +399,7 @@ ignored.
397399
"""
398400
function Base.convert(::Type{<:NonlinearSystem},rs::ReactionSystem; combinatoric_ratelaws=true)
399401
eqs = assemble_drift(rs; combinatoric_ratelaws=combinatoric_ratelaws, as_odes=false)
400-
NonlinearSystem(eqs,rs.states,rs.ps,name=rs.name,systems=convert.(NonlinearSystem,rs.systems))
402+
NonlinearSystem(eqs,states(rs),get_ps(rs),name=nameof(rs),systems=convert.(NonlinearSystem,get_systems(rs)))
401403
end
402404

403405
"""
@@ -424,12 +426,12 @@ This input may contain repeat parameters.
424426
function Base.convert(::Type{<:SDESystem},rs::ReactionSystem, combinatoric_ratelaws=true; noise_scaling=nothing)
425427

426428
if noise_scaling isa Vector
427-
(length(noise_scaling)!=length(rs.eqs)) &&
429+
(length(noise_scaling)!=length(equations(rs))) &&
428430
error("The number of elements in 'noise_scaling' must be equal " *
429431
"to the number of reactions in the reaction system.")
430432
noise_scaling = value.(noise_scaling)
431433
elseif !isnothing(noise_scaling)
432-
noise_scaling = fill(value(noise_scaling),length(rs.eqs))
434+
noise_scaling = fill(value(noise_scaling),length(equations(rs)))
433435
end
434436

435437
eqs = assemble_drift(rs; combinatoric_ratelaws=combinatoric_ratelaws)
@@ -439,12 +441,12 @@ function Base.convert(::Type{<:SDESystem},rs::ReactionSystem, combinatoric_ratel
439441

440442
SDESystem(eqs,
441443
noiseeqs,
442-
rs.iv,
443-
rs.states,
444+
get_iv(rs),
445+
states(rs),
444446
(noise_scaling===nothing) ?
445-
rs.ps :
446-
union(rs.ps,toparam.(noise_scaling)),
447-
name=rs.name,systems=convert.(SDESystem,rs.systems))
447+
get_ps(rs) :
448+
union(get_ps(rs),toparam.(noise_scaling)),
449+
name=rs.name,systems=convert.(SDESystem,get_systems(rs)))
448450
end
449451

450452
"""
@@ -462,8 +464,8 @@ Notes:
462464
"""
463465
function Base.convert(::Type{<:JumpSystem},rs::ReactionSystem; combinatoric_ratelaws=true)
464466
eqs = assemble_jumps(rs; combinatoric_ratelaws=combinatoric_ratelaws)
465-
JumpSystem(eqs,rs.iv,rs.states,rs.ps,name=rs.name,
466-
systems=convert.(JumpSystem,rs.systems))
467+
JumpSystem(eqs,get_iv(rs),states(rs),get_ps(rs),name=nameof(rs),
468+
systems=convert.(JumpSystem,get_systems(rs)))
467469
end
468470

469471

@@ -484,7 +486,7 @@ end
484486
# SDEProblem from AbstractReactionNetwork
485487
function DiffEqBase.SDEProblem(rs::ReactionSystem, u0, tspan, p=DiffEqBase.NullParameters(), args...; noise_scaling=nothing, kwargs...)
486488
sde_sys = convert(SDESystem,rs,noise_scaling=noise_scaling)
487-
p_matrix = zeros(length(rs.states), length(rs.eqs))
489+
p_matrix = zeros(length(states(rs)), length(equations(rs)))
488490
return SDEProblem(sde_sys,u0,tspan,p,args...; noise_rate_prototype=p_matrix,kwargs...)
489491
end
490492

0 commit comments

Comments
 (0)