Pkg.jl
Pkg.jl copied to clipboard
Weak dependency compat not respected
With this Project.toml
file
[deps]
WebIO = "0f1e0344-ec1d-5b48-a673-e5cf874b6c29"
[weakdeps]
WebSockets = "104b5d7c-a370-577a-8038-80a2059c5097"
[compat]
WebSockets = "~1.5"
WebSockets 1.6 ends up being installed. This seems like the simplest possible use case of weak dependencies as described here: https://pkgdocs.julialang.org/v1/creating-packages/#Weak-dependencies
A weak dependency is a dependency that will not automatically install when the package is installed but you can still control what versions of that package are allowed to be installed by setting compatibility on it
so I find it quite surprising that it doesn't work.
Example:
(@v1.10) pkg> activate --temp
Activating new project at `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns`
(jl_iiJvns) pkg> add WebIO
Resolving package versions...
Updating `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Project.toml`
[0f1e0344] + WebIO v0.8.21
Updating `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Manifest.toml`
[...]
[104b5d7c] + WebSockets v1.6.0
[...]
(jl_iiJvns) pkg> # edit Project.toml to add `weakdeps` and `compat` section
(jl_iiJvns) pkg> status
Status `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Project.toml`
[0f1e0344] WebIO v0.8.21
Warning The project dependencies or compat requirements have changed since the manifest was last resolved. It is recommended to `Pkg.resolve()` or consider `Pkg.update()` if necessary.
(jl_iiJvns) pkg> up
Updating registry at `C:\Users\sternlab\.julia\registries\General`
Updating git-repo `https://github.com/JuliaRegistries/General.git`
No Changes to `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Project.toml`
No Changes to `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Manifest.toml`
(jl_iiJvns) pkg> resolve
ERROR: empty intersection between [email protected] and project compatibility 1.5
(jl_iiJvns) pkg> status -m WebSockets
Status `C:\Users\sternlab\AppData\Local\Temp\jl_iiJvns\Manifest.toml`
[104b5d7c] WebSockets v1.6.0
julia> versioninfo()
Julia Version 1.10.0
Commit 3120989f39 (2023-12-25 18:01 UTC)
Build Info:
Official https://julialang.org/ release
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: 16 × Intel(R) Core(TM) i7-9800X CPU @ 3.80GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-15.0.7 (ORCJIT, skylake-avx512)
Threads: 1 on 16 virtual cores