Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

weakdeps don't load from fallback environment #48351

Closed
timholy opened this issue Jan 19, 2023 · 1 comment · Fixed by #48352
Closed

weakdeps don't load from fallback environment #48351

timholy opened this issue Jan 19, 2023 · 1 comment · Fixed by #48352
Assignees
Labels
packages Package management and loading

Comments

@timholy
Copy link
Member

timholy commented Jan 19, 2023

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
@timholy timholy added the packages Package management and loading label Jan 19, 2023
@KristofferC KristofferC self-assigned this Jan 19, 2023
@KristofferC
Copy link
Member

break # For now, only insert triggers for packages in the first load_path.
.

I think that is an old thing that was there before I had a more clear picture of how extensions should work with environment stacks. Should be fine to just remove it. I will do that and add a test.

@fredrikekre fredrikekre added the backport 1.9 Change should be backported to release-1.9 label Jan 19, 2023
@KristofferC KristofferC removed the backport 1.9 Change should be backported to release-1.9 label Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
packages Package management and loading
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants