Skip to content

Commit 746317b

Browse files
authored
Fix the doctests and the broken CI (#98)
* Fix the doctests and the broken CI * Add `Functors.jl` as a doc dependency
1 parent c174c92 commit 746317b

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
Pkg.develop(PackageSpec(path=pwd()))
6868
Pkg.instantiate()'
6969
- run: |
70-
julia --project=docs/ -e '
70+
julia --color=yes --project=docs/ -e '
7171
using Optimisers
7272
using Documenter
7373
using Documenter: doctest

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
Functors = "d9f16b24-f501-4c13-a1f2-28368ffc5196"
4+
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
5+
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

docs/make.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using Documenter, Optimisers
1+
using Documenter, Optimisers, Zygote, StaticArrays, Functors
22

33
DocMeta.setdocmeta!(Optimisers, :DocTestSetup, :(using Optimisers); recursive = true)
44

5-
makedocs(modules = [Optimisers],
6-
doctest = VERSION == v"1.6",
5+
makedocs(modules = [Optimisers, Zygote, StaticArrays, Functors],
6+
doctest = false,
77
sitename = "Optimisers.jl",
88
pages = ["Home" => "index.md",
99
"API" => "api.md"],

src/Optimisers.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ The recursion into structures uses Functors.jl, and any new `struct`s containing
7474
need to be marked with `Functors.@functor` before use.
7575
See [the Flux docs](https://fluxml.ai/Flux.jl/stable/models/advanced/) for more about this.
7676
77-
```
77+
```jldoctest
7878
julia> struct Layer; mat; fun; end
7979
8080
julia> model = (lay = Layer([1 2; 3 4f0], sin), vec = [5, 6f0]);
8181
8282
julia> Optimisers.setup(Momentum(), model) # new struct is by default ignored
83-
(lay = nothing, vec = Leaf(Momentum{Float32}(0.01, 0.9), [0.0, 0.0]))
83+
(lay = nothing, vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
8484
8585
julia> destructure(model)
8686
(Float32[5.0, 6.0], Restructure(NamedTuple, ..., 2))
8787
8888
julia> using Functors; @functor Layer # annotate this type as containing parameters
8989
9090
julia> Optimisers.setup(Momentum(), model)
91-
(lay = (mat = Leaf(Momentum{Float32}(0.01, 0.9), [0.0 0.0; 0.0 0.0]), fun = nothing), vec = Leaf(Momentum{Float32}(0.01, 0.9), [0.0, 0.0]))
91+
(lay = (mat = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0 0.0; 0.0 0.0]), fun = nothing), vec = Leaf(Momentum{Float32}(0.01, 0.9), Float32[0.0, 0.0]))
9292
9393
julia> destructure(model)
9494
(Float32[1.0, 3.0, 2.0, 4.0, 5.0, 6.0], Restructure(NamedTuple, ..., 6))

0 commit comments

Comments
 (0)