Skip to content

try_use_package fails due to environment conflicts #191

@mortenpi

Description

@mortenpi

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:
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'`)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions