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

pkg> add for a weakdep package does not permanently install package #3797

Closed
topolarity opened this issue Feb 14, 2024 · 2 comments · Fixed by #3865
Closed

pkg> add for a weakdep package does not permanently install package #3797

topolarity opened this issue Feb 14, 2024 · 2 comments · Fixed by #3865

Comments

@topolarity
Copy link
Member

topolarity commented Feb 14, 2024

If you pkg> add a package that's already in your Project.toml as a weakdep, Pkg gets mildly indecisive and installs all of the package + deps only to remove them on the next package operation.

MWE:

$ cat Foo/Project.toml
name = "Foo"
uuid = "721b2572-63d0-4bb6-a91e-fe9952250d90"
authors = ["Cody Tapscott <topolarity@tapscott.me>"]
version = "0.1.0"

[weakdeps]
CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba"

[compat]
CUDA = "4"
$ julia --project=Foo -q
(Foo) pkg> add CUDA
<adds a ton of CUDA + dependent packages>
(Foo) pkg> add TOML
<immediately removes all of CUDA + its dependent packages>

It is a bit concerning that > add Foo can have an inconsistent concept of the state after an add versus the rest of Pkg.

@topolarity topolarity changed the title pkg> add for a weakdep package does not perminately install package pkg> add for a weakdep package does not permanently install package Feb 14, 2024
@KristofferC
Copy link
Sponsor Member

The reason for this is that when Pkg reads a project and sees that it is both a weakdep and a dep it ignores the dep entry (so that extensions can be used in a backwards compatible manner).

The solution here might be to just delete the weak dep entry when an explicit add is made.

@KristofferC
Copy link
Sponsor Member

But on the other hand, having extensions while having strong deps on the triggers for those extensions is very likely to run into a cycle analogous to JuliaLang/julia#52511 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants