JuliaLang / Pkg.jl

Pkg - Package manager for the Julia programming language
https://pkgdocs.julialang.org
Other
616 stars 258 forks source link

Dependency is in both `weakdeps` and `deps` #3727

Open simonbyrne opened 8 months ago

simonbyrne commented 8 months ago

You can get some weird behavior if a package is in both deps and weakdeps.

shell> cat Project.toml
[weakdeps]
Example = "7876af07-990d-54b4-ab0e-23690620f79a"

(ddtest) pkg> instantiate
  No Changes to `~/misc/ExtensionsConflict/ddtest/Project.toml`
  No Changes to `~/misc/ExtensionsConflict/ddtest/Manifest.toml`

(ddtest) pkg> add Example # will happily install it
   Resolving package versions...
    Updating `~/misc/ExtensionsConflict/ddtest/Project.toml`
  [7876af07] + Example v0.5.3
    Updating `~/misc/ExtensionsConflict/ddtest/Manifest.toml`
  [7876af07] + Example v0.5.3

julia> using Example # can now load it

(ddtest) pkg> resolve # removes it
  No Changes to `~/misc/ExtensionsConflict/ddtest/Project.toml`
    Updating `~/misc/ExtensionsConflict/ddtest/Manifest.toml`
  [7876af07] - Example v0.5.3
simonbyrne commented 8 months ago

Should this be an error?

IanButterworth commented 8 months ago

As far as I know that's expected behavior, a package that's both in weakdeps and deps is treated as a weapdep on 1.9+. On <1.9 it's treated as a dep. Its for backwards compatability,

DilumAluthge commented 8 months ago

Should we explicitly document this behavior, maybe somewhere in the Pkg manual?

IanButterworth commented 8 months ago

https://pkgdocs.julialang.org/v1/creating-packages/#Transition-from-normal-dependency-to-extension