JuliaDocs / DocumentationGenerator.jl

MIT License
21 stars 7 forks source link

try_use_package fails due to environment conflicts #191

Open mortenpi opened 1 year ago

mortenpi commented 1 year ago

try_use_package loads the package in the current environment. But this can cause problems if there are conflicts between the dependencies of the two.

This is the case for MarkdownAST, which fails to precompile. In this case, DocumentationGenerator restricts AbstractTrees to 0.3, but MarkdownAST needs 0.4, and will fail to precompile with 0.3.

┌ Error: `using MarkdownAST did not succeed.`
--
31 | │   exception =
32 | │    LoadError: UndefVarError: childtype not defined
33 | │    in expression starting at /juliateam/.julia/packages/MarkdownAST/CZtZT/src/abstracttrees.jl:4
34 | │    in expression starting at /juliateam/.julia/packages/MarkdownAST/CZtZT/src/MarkdownAST.jl:1
35 | └ @ DocumentationGenerator ~/.julia/packages/DocumentationGenerator/PsZDA/src/DocumentationGenerator.jl:39
Can be MWEd with this: ```julia using DocumentationGenerator installable_packages = DocumentationGenerator.installable_on_version(VERSION) pkg = let pkgname = "MarkdownAST", pkgs = collect(installable_packages) i = findfirst(kv -> kv.second.name == pkgname, pkgs) pkgs[i].second end pkg = (; pkg..., server_type = "github", api_url="") DocumentationGenerator.build_documentation([pkg], basepath=joinpath(@__DIR__)) ```

While #180 would fix the immediate issue, I think DocumentationGenerator should never load the packages it builds into the main env. Instead, it could probably do this check with something like

run(`julia --project=$envdir -e'using $pkg'`)
mortenpi commented 1 year ago

Ah, just noticed #161 and #162.