Error: failed to evaluate `Modules =

I have a docs page with this autodocs field (without the comments):

#```@autodocs
Modules = [MolSimToolkit.Reweighting]
Pages = ["Reweighting/reweighting.jl"]
Order = [:function, :type]
#```

The module Reweighting is in the file /src/Reweighting/reweighthing.jl.

This autodocs fais with:

┌ Error: failed to evaluate `Modules = [MolSimToolkit.Reweighting]` in `@autodocs` block in src/Reweighting.md:111-115
│ ```@autodocs
│ Modules = [MolSimToolkit.Reweighting]
│ Pages = ["Reweighting/reweighting.jl"]
│ Order = [:function, :type]
│ ```
│   exception = UndefVarError: `Reweighting` not defined
└ @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/utilities/utilities.jl:44
┌ Error: '@autodocs' missing 'Modules = ...' in src/Reweighting.md:111-115
│ ```@autodocs
│ Modules = [MolSimToolkit.Reweighting]
│ Pages = ["Reweighting/reweighting.jl"]
│ Order = [:function, :type]
│ ```
└ @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/utilities/utilities.jl:44
[ Info: CrossReferences: building cross-references.
[ Info: CheckDocument: running document checks.
[ Info: Populate: populating indices.
ERROR: `makedocs` encountered an error [:autodocs_block] -- terminating build before rendering.
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] runner(::Type{Documenter.Builder.RenderDocument}, doc::Documenter.Document)
   @ Documenter ~/.julia/packages/Documenter/pA5Sa/src/builder_pipeline.jl:253
 [3] dispatch(::Type{Documenter.Builder.DocumentPipeline}, x::Documenter.Document)
   @ Documenter.Selectors ~/.julia/packages/Documenter/pA5Sa/src/utilities/Selectors.jl:170
 [4] #84
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:248 [inlined]
 [5] withenv(::Documenter.var"#84#86"{Documenter.Document}, ::Pair{String, Nothing}, ::Vararg{Pair{String, Nothing}})
   @ Base ./env.jl:257
 [6] #83
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]
 [7] cd(f::Documenter.var"#83#85"{Documenter.Document}, dir::String)
   @ Base.Filesystem ./file.jl:112
 [8] #makedocs#82
   @ ~/.julia/packages/Documenter/pA5Sa/src/makedocs.jl:247 [inlined]
 [9] top-level scope
   @ ~/Downloads/MolSimToolkit.jl/docs/make.jl:7

I tried changing the path of the files, the names, but for now without success. In the same project I have some other similar structures which do work.

Any ideas?

In any case, to reproduce it:

git clone https://github.com/LV-IQ/MolSimToolkit.jl
cd MolSimToolkit.jl
julia --project
] activate docs
instantiate
using LiveServer
servedocs()

I think I found what may be the issue, but it is more related to how to develop packages in general:

This is a fork of the original package. But in the docs we have Project.toml that points to dev MolSimToolkit.

Then, the docs project loads the .julia/dev/MolSimToolkit.jl version, which is not the version of the package that has to be loaded here, which is the one on the top folder of the current git fork (../MolSimToolkit).

How can I make the Project.toml project point to the current local directory of the main package, so that instantiate the docs project uses the current version instead of a devd version of the main package?

Ok, this can be solved by:

docs> rm MolSimToolkit

docs> add "../MolSimToolkit.jl"

which is slightly annoying because when one does dev MolSimToolkit the directory does not carry the .jl, such that we need to have different Project.toml files for the docs project in a fork relative to the main package.

edit: actually different Manifest.toml files, but I’m not even uploading them. So I don’t see a solution really, except dealing locally with these differences…

You actually can do something like “take the parents folder under development”, see Manopt.jl/docs/make.jl at 77c672042d41657af9d8d95e37bc972acd96ed70 · JuliaManifolds/Manopt.jl · GitHub

this and the following resolve should make it work just fine, I think.

1 Like

Won’t that interfere with the deployment of the stable docs?

I did not think so, but indeed, if you are fast enough, it might, Running this on main after registration might pick a newer version if between staring the registration and the tag run you manage to commit to main.

1 Like