From 01a08b0578a805f65a734bebfcc688b2859b6966 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Fri, 29 Dec 2023 21:24:11 +0100 Subject: [PATCH 1/4] Aqua CI --- Project.toml | 7 +++++-- test/qa.jl | 11 +++++++++++ test/runtests.jl | 4 +++- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 test/qa.jl diff --git a/Project.toml b/Project.toml index a035464..46cbad5 100644 --- a/Project.toml +++ b/Project.toml @@ -4,10 +4,13 @@ authors = ["Aayush Sabharwal 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"] diff --git a/test/qa.jl b/test/qa.jl new file mode 100644 index 0000000..b2926d8 --- /dev/null +++ b/test/qa.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index 20538d7..beeda77 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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 From 4d1173439d4e74e6971708fee9ec2bd8df61c990 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Fri, 29 Dec 2023 21:26:18 +0100 Subject: [PATCH 2/4] Downgrade CI --- .github/workflows/Downgrade.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/Downstream.yml | 2 +- .github/workflows/ci.yml | 1 - 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/Downgrade.yml diff --git a/.github/workflows/Downgrade.yml b/.github/workflows/Downgrade.yml new file mode 100644 index 0000000..01ff8ca --- /dev/null +++ b/.github/workflows/Downgrade.yml @@ -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 \ No newline at end of file diff --git a/.github/workflows/Downstream.yml b/.github/workflows/Downstream.yml index 531d600..e8c58e1 100644 --- a/.github/workflows/Downstream.yml +++ b/.github/workflows/Downstream.yml @@ -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} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d0c55a6..ad9c22b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ jobs: - All version: - '1' - - '1.6' steps: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@v1 From d80b0d5ecf11e5cd86f9e38e9326ccb9aaeacffd Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Fri, 29 Dec 2023 21:38:27 +0100 Subject: [PATCH 3/4] Documenter 1.0 upgrade --- .gitignore | 2 ++ docs/Project.toml | 2 +- docs/src/index.md | 45 ++++++++++++++++++++++++--------------------- docs/src/usage.md | 2 +- src/interface.jl | 2 -- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/.gitignore b/.gitignore index b067edd..f0dafb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ /Manifest.toml + +docs/Manifest.toml diff --git a/docs/Project.toml b/docs/Project.toml index 1e8f527..593250b 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -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" diff --git a/docs/src/index.md b/docs/src/index.md index 7d6b3e9..6de2852 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -24,56 +24,59 @@ Pkg.add("SymbolicIndexingInterface") - see also [SciML Community page](https://sciml.ai/community/) ## Reproducibility + ```@raw html
The documentation of this SciML package was built using these direct dependencies, ``` + ```@example using Pkg # hide Pkg.status() # hide ``` + ```@raw html
``` + ```@raw html
and using this machine and Julia version. ``` + ```@example using InteractiveUtils # hide versioninfo() # hide ``` + ```@raw html
``` + ```@raw html
A more complete overview of all dependencies and their versions is also provided. ``` + ```@example using Pkg # hide -Pkg.status(;mode = PKGMODE_MANIFEST) # hide +Pkg.status(; mode = PKGMODE_MANIFEST) # hide ``` + ```@raw html
``` -```@raw html -You can also download the -manifest file and the -project 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. +""") ``` \ No newline at end of file diff --git a/docs/src/usage.md b/docs/src/usage.md index d45d504..200fd4e 100644 --- a/docs/src/usage.md +++ b/docs/src/usage.md @@ -21,7 +21,7 @@ sys = structural_simplify(sys) The system has 4 state variables, 3 parameters and one observed variable: ```@example Usage -observed(sys) +ModelingToolkit.observed(sys) ``` Solving the system, diff --git a/src/interface.jl b/src/interface.jl index 67fab0e..9de7a46 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -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 From 0cf1623a3e3c73b6cb32e4436d05238e592e83d9 Mon Sep 17 00:00:00 2001 From: Arno Strouwen Date: Fri, 29 Dec 2023 22:00:48 +0100 Subject: [PATCH 4/4] LanguageTool --- docs/src/tutorial.md | 14 +++++++------- docs/src/usage.md | 4 ++-- src/interface.jl | 12 ++++++------ src/parameter_indexing.jl | 2 +- src/symbol_cache.jl | 4 ++-- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/src/tutorial.md b/docs/src/tutorial.md index 5a7f797..bd92b18 100644 --- a/docs/src/tutorial.md +++ b/docs/src/tutorial.md @@ -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 @@ -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 @@ -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 diff --git a/docs/src/usage.md b/docs/src/usage.md index 200fd4e..8b77048 100644 --- a/docs/src/usage.md +++ b/docs/src/usage.md @@ -19,7 +19,7 @@ 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 ModelingToolkit.observed(sys) ``` @@ -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 diff --git a/src/interface.jl b/src/interface.jl index 9de7a46..9838b1e 100644 --- a/src/interface.jl +++ b/src/interface.jl @@ -33,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)) @@ -88,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) """ @@ -137,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). """ @@ -149,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). """ diff --git a/src/parameter_indexing.jl b/src/parameter_indexing.jl index c23b373..c6745ab 100644 --- a/src/parameter_indexing.jl +++ b/src/parameter_indexing.jl @@ -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 diff --git a/src/symbol_cache.jl b/src/symbol_cache.jl index 8df5dda..2509f96 100644 --- a/src/symbol_cache.jl +++ b/src/symbol_cache.jl @@ -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