Skip to content

Sub-module loading package triggers top-level module at __init__() timeΒ #88

@mossr

Description

@mossr

Say I have a module TopLevel that I want to @require a package (e.g., ProgressMeter)

module TopLevel

using Requires
__init__() = @require ProgressMeter="92933f4c-e287-5a05-a399-4b506db050ca" println("ProgressMeter loaded!")

using Main.SubModule # this uses ProgressMeter internally

end

and I have a sub-module that itself uses ProgressMeter:

module SubModule
    using ProgressMeter # used internal to "SubModule"
    # ...
end

The TopLevel module will always think ProgressMeter is loaded because of a sub-module that uses it internally.
This means for the TopLevel package, I cannot @require any packages that are used by dependencies (some of which may be unknown to the developer of TopLevel, causing head-scratching behavior πŸ˜„)

Is there a way to ensure that the scope of the @required package is limited to modules "outside" the top-level module?

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