How does Documenter.jl import the parent package?

I am writing documentation for my package AISCSteel.jl. I am wanting to use my other package Handcalcs.jl to show some of the steps in the documentation.

There is one limitation to Handcalcs.jl and that is that it will not properly work if the function it is looking for is inside the main scope.

I am able to build the documentation locally and everything works as expected. However, when the CI tries to build the docs, it fails because Handcalcs can’t introspect the function.

Which leads me to my question. How does Documenter.jl actually import AISCSteel.jl when it is building the documentation for it?

If it just does a dev on the package, I would expect Handcalcs to work. However, if it is doing an include on the AISCSteel.jl file then I would not expect Handcalcs to work.

Actually, I may need to do a using Revise… hold on

Nope that was not it. Still failing for some reason.

What is the actual error you get?

Documenter doesn’t do anything special with regards to importing the package afaik - it’s all up to the usual Julia mechanisms of Project and Manifest and the using line you add to your make.jl, no special magic. This kind of “works locally but fails at CI” issue most often happens due to the difference in Manifests between the two. Knowing the specific error you get will help determine the exact cause.

If you’re only targeting recent versions of Julia (1.11+), the sources section of Project.toml allows you to specify the path to the AISCSteel version to use. If you need to build docs using old versions of Julia too (for eg. for the sake of doctests), then you might need to mess with the LOAD_PATH and such.

1 Like

I realized after you said this that using Revise needs to be before the using AISCSteel line in the make.jl file. The docs are building now. Thanks!

You seem to have solved your broader issue, but to answer this specific question (maybe for future readers), this is where the documentation-building environment gets set up:

As you can see, in your case it’s not done by Documenter itself, but rather by your CI configuration. (Which might explain the differences you saw between your local environment and the CI.)

Not all projects do the same thing however. Some projects bring the documented package path into the LOAD_PATH in docs/make.jl. This is discussed here in the Documenter documentation:

1 Like