Skip to content

Commit

Permalink
Merge pull request #19 from ArnoStrouwen/ci
Browse files Browse the repository at this point in the history
Various upgrades
  • Loading branch information
ChrisRackauckas authored Dec 30, 2023
2 parents 0cd263e + 0cf1623 commit 81c9968
Show file tree
Hide file tree
Showing 14 changed files with 95 additions and 48 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/Downgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Downgrade
on:
pull_request:
branches:
- master
paths-ignore:
- 'docs/**'
push:
branches:
- master
paths-ignore:
- 'docs/**'
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
version: ['1']
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: ${{ matrix.version }}
- uses: cjdoris/julia-downgrade-compat-action@v1
# if: ${{ matrix.version == '1.6' }}
with:
skip: Pkg,TOML
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-runtest@v1
2 changes: 1 addition & 1 deletion .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
julia-version: [1,1.6]
julia-version: [1]
os: [ubuntu-latest]
package:
- {user: SciML, repo: RecursiveArrayTools.jl, group: All}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
- All
version:
- '1'
- '1.6'
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
/Manifest.toml

docs/Manifest.toml
7 changes: 5 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@ authors = ["Aayush Sabharwal <[email protected]> and contributors"]
version = "0.3.1"

[compat]
julia = "1.9"
Aqua = "0.8"
Test = "1"
julia = "1.10"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]
test = ["Aqua", "Test"]
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5"

[compat]
Documenter = "0.27"
Documenter = "1"
SymbolicIndexingInterface = "0.3"
45 changes: 24 additions & 21 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,56 +24,59 @@ Pkg.add("SymbolicIndexingInterface")
- see also [SciML Community page](https://sciml.ai/community/)

## Reproducibility

```@raw html
<details><summary>The documentation of this SciML package was built using these direct dependencies,</summary>
```

```@example
using Pkg # hide
Pkg.status() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>and using this machine and Julia version.</summary>
```

```@example
using InteractiveUtils # hide
versioninfo() # hide
```

```@raw html
</details>
```

```@raw html
<details><summary>A more complete overview of all dependencies and their versions is also provided.</summary>
```

```@example
using Pkg # hide
Pkg.status(;mode = PKGMODE_MANIFEST) # hide
Pkg.status(; mode = PKGMODE_MANIFEST) # hide
```

```@raw html
</details>
```
```@raw html
You can also download the
<a href="
```
```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Manifest.toml"
```
```@raw html
">manifest</a> file and the
<a href="
```

```@eval
using TOML
version = TOML.parse(read("../../Project.toml",String))["version"]
name = TOML.parse(read("../../Project.toml",String))["name"]
link = "https://github.com/SciML/"*name*".jl/tree/gh-pages/v"*version*"/assets/Project.toml"
```
```@raw html
">project</a> file.
using Markdown
version = TOML.parse(read("../../Project.toml", String))["version"]
name = TOML.parse(read("../../Project.toml", String))["name"]
link_manifest = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Manifest.toml"
link_project = "https://github.com/SciML/" * name * ".jl/tree/gh-pages/v" * version *
"/assets/Project.toml"
Markdown.parse("""You can also download the
[manifest]($link_manifest)
file and the
[project]($link_project)
file.
""")
```
14 changes: 7 additions & 7 deletions docs/src/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ symbolic_container(sys::MySolutionWrapper) = sys.sol
Since `symbolic_container` will return the wrapped solution, all method calls such as
`is_parameter(sys::MySolutionWrapper, sym)` will be forwarded to `is_parameter(sys.sol, sym)`.

In case some methods need to function differently than those of the wrapped type, they can selectively
be defined. For example, suppose `MySolutionWrapper` does not support observed quantities. The following
In cases where some methods need to function differently than those of the wrapped type, they can be selectively
defined. For example, suppose `MySolutionWrapper` does not support observed quantities. The following
method can be defined (in addition to the one above):

```julia
Expand All @@ -33,8 +33,8 @@ is_observed(sys::MySolutionWrapper, sym) = false

## Defining the interface in its entirety

Not all of the methods in the interface are required. Some only need to be implemented if a type
supports specific functionality. Consider the following struct which needs to implement the interface:
Not all the methods in the interface are required. Some only need to be implemented if a type
supports specific functionality. Consider the following struct, which needs to implement the interface:

```julia
struct ExampleSolution
Expand Down Expand Up @@ -150,10 +150,10 @@ on a type that wraps this type. An example is `ModelingToolkit.AbstractSystem`,
can identify whether a value is observed, but cannot implement `observed` itself.

Other optional methods relate to parameter indexing. If a type contains the values of
parameter variables, it must implement [`parameter_values`](@ref). This will allow the
parameter variables, it must implement [`parameter_values`](@ref). This allows the
default definitions of [`getp`](@ref) and [`setp`](@ref) to work. While `setp` is
not typically useful for solution objects, it may be useful for integrators. Typically
the default implementations for `getp` and `setp` will suffice and manually defining
not typically useful for solution objects, it may be useful for integrators. Typically,
the default implementations for `getp` and `setp` will suffice, and manually defining
them is not necessary.

```julia
Expand Down
6 changes: 3 additions & 3 deletions docs/src/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ eqs = [D(D(x)) ~ σ * (y - x),
sys = structural_simplify(sys)
```

The system has 4 state variables, 3 parameters and one observed variable:
The system has 4 state variables, 3 parameters, and one observed variable:
```@example Usage
observed(sys)
ModelingToolkit.observed(sys)
```

Solving the system,
Expand Down Expand Up @@ -126,7 +126,7 @@ The updated parameter values can be checked using [`parameter_values`](@ref).
parameter_values(prob)
```

Solving the new system, note that the parameter getter functions still work on the new
When solving the new system, note that the parameter getter functions still work on the new
solution object.

```@example Usage
Expand Down
14 changes: 6 additions & 8 deletions src/interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ Using `p`, return an object that implements the symbolic indexing interface. In
itself implements the interface, `p` can be returned as-is. All symbolic indexing interface
methods fall back to calling the same method on `symbolic_container(p)`, so this may be
used for trivial implementations of the interface that forward all calls to another object.
This is also used by [`ParameterIndexingProxy`](@ref)
"""
function symbolic_container end

Expand Down Expand Up @@ -35,7 +33,7 @@ Return a vector of the symbolic variables being solved for in the system `sys`.
the current time index. The returned vector should not be mutated.
For types that implement `Base.getindex` with symbolic indices using this interface,
The shorthand `sys[solvedvariables]` can be used as shorthand for
the shorthand `sys[solvedvariables]` can be used as shorthand for
`sys[variable_symbols(sys)]`. See: [`solvedvariables`](@ref).
"""
variable_symbols(sys) = variable_symbols(symbolic_container(sys))
Expand Down Expand Up @@ -90,10 +88,10 @@ is_observed(sys, sym) = is_observed(symbolic_container(sys), sym)
Return the observed function of the given `sym` in `sys`. The returned function should
have the signature `(u, p) -> [values...]` where `u` and `p` is the current state and
parameter vector. If `istimedependent(sys) == true`, the function should accept
parameter vector, respectively. If `istimedependent(sys) == true`, the function should accept
the current time `t` as its third parameter. If `constant_structure(sys) == false`,
accept a third parameter which can either be a vector of symbols indicating the order
of states or a time index which identifies the order of states.
accept a third parameter, which can either be a vector of symbols indicating the order
of states or a time index, which identifies the order of states.
See also: [`is_time_dependent`](@ref), [`constant_structure`](@ref)
"""
Expand Down Expand Up @@ -139,7 +137,7 @@ struct SolvedVariables end
"""
const solvedvariables = SolvedVariables()
This singleton is used as a shortcut to allow indexing all solution variables
This singleton is used as a shortcut to allow indexing of all solution variables
(excluding observed quantities). It has a [`symbolic_type`](@ref) of
[`ScalarSymbolic`](@ref). See: [`variable_symbols`](@ref).
"""
Expand All @@ -151,7 +149,7 @@ struct AllVariables end
"""
const allvariables = AllVariables()
This singleton is used as a shortcut to allow indexing all solution variables
This singleton is used as a shortcut to allow indexing of all solution variables
(including observed quantities). It has a [`symbolic_type`](@ref) of
[`ScalarSymbolic`](@ref). See [`all_variable_symbols`](@ref).
"""
Expand Down
2 changes: 1 addition & 1 deletion src/parameter_indexing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ end
"""
setp(sys, p)
Return a function that takes an integrator of `sys` and a value, and sets the
Return a function that takes an integrator of `sys` and a value, and sets
the parameter `p` to that value. Note that `p` can be a direct numerical index or a
symbolic value. Requires that the integrator implement [`parameter_values`](@ref) and the
returned collection be a mutable reference to the parameter vector in the integrator. In
Expand Down
4 changes: 2 additions & 2 deletions src/symbol_cache.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
function SymbolCache(vars, [params, [indepvars]])
A struct implementing the symbolic indexing interface for the trivial case
of having a vector of variables, parameters and independent variables. This
of having a vector of variables, parameters, and independent variables. This
struct does not implement `observed`, and `is_observed` returns `false` for
all input symbols. It is considered to be time dependent if it contains
all input symbols. It is considered time dependent if it contains
at least one independent variable.
The independent variable may be specified as a single symbolic variable instead of an
Expand Down
11 changes: 11 additions & 0 deletions test/qa.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using SymbolicIndexingInterface, Aqua
@testset "Aqua" begin
Aqua.find_persistent_tasks_deps(SymbolicIndexingInterface)
Aqua.test_ambiguities(SymbolicIndexingInterface, recursive = false)
Aqua.test_deps_compat(SymbolicIndexingInterface)
Aqua.test_piracies(SymbolicIndexingInterface)
Aqua.test_project_extras(SymbolicIndexingInterface)
Aqua.test_stale_deps(SymbolicIndexingInterface)
Aqua.test_unbound_args(SymbolicIndexingInterface)
Aqua.test_undefined_exports(SymbolicIndexingInterface)
end
4 changes: 3 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using SymbolicIndexingInterface
using Test

@testset "Quality Assurance" begin
@time include("qa.jl")
end
@testset "Interface test" begin
@time include("example_test.jl")
end
Expand Down

0 comments on commit 81c9968

Please sign in to comment.