Closed
Description
Extension modules (weak dependencies) only seem to load if both packages are in the currently-active environment. The docs say
An extension will only be loaded if the extension dependencies are loaded from the same environment or environments higher in the environment stack than the package itself.
but I am not certain that applies here, since both packages are in the same (default) environment. Either the docs might benefit from clarification, or there may be a bug.
Demo:
julia> using PkgCacheInspector, MethodAnalysis
julia> methods(methodinstances, (PkgCacheInfo,))
# 1 method for generic function "methodinstances" from MethodAnalysis:
[1] methodinstances(info::PkgCacheInfo)
@ MethodAnalysisExt ~/.julia/packages/PkgCacheInspector/s2sOo/ext/MethodAnalysisExt.jl:5
That works (both are in my default environment).
Now open a fresh session:
(@v1.10) pkg> generate A
Generating project A:
A/Project.toml
A/src/A.jl
(@v1.10) pkg> activate ./A
Activating project at `/tmp/pkgs/A`
(A) pkg> st
Project A v0.1.0
Status `/tmp/pkgs/A/Project.toml` (empty project)
julia> using PkgCacheInspector, MethodAnalysis
julia> methods(methodinstances, (PkgCacheInfo,))
# 1 method for generic function "methodinstances" from MethodAnalysis:
[1] methodinstances(top)
@ ~/.julia/packages/MethodAnalysis/oGkyP/src/MethodAnalysis.jl:171
Note that this is the generic method, indicating that the one specialized for PkgCacheInfo
didn't load.
In case this has already been fixed, worth saying my master
is a few days old:
julia> versioninfo()
Julia Version 1.10.0-DEV.368
Commit 65e6919079 (2023-01-14 12:26 UTC)
Platform Info:
OS: Linux (x86_64-linux-gnu)
CPU: 16 × 12th Gen Intel(R) Core(TM) i7-1260P
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)
Threads: 1 on 16 virtual cores