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

When manifest =... is set, removing a dependency doesn't remove it from the Manifest.toml #3590

Open
nickrobinson251 opened this issue Aug 16, 2023 · 3 comments

Comments

@nickrobinson251
Copy link
Contributor

nickrobinson251 commented Aug 16, 2023

This is an issue for packages setting the manifest = ... argument in their Project.toml

The problem we're seeing is that, if you have a package Foo with a Project.toml (at e.g. packages/Foo/Project.toml) which looks like:

name = "Foo"
uuid = "801270c1-6d38-4c07-85b6-74a2f576d89a"
manifest = "../../Manifest.toml"
version = "0.1.0"

[deps]
Compat = "34da2185-b29b-5c13-b0c7-acf172513d20"
ContextVariablesX = "6add18c4-b38d-439d-96f6-d6bc489c04c5"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
ExceptionUnwrapping = "460bff9d-24e4-43bc-9d9f-a8973cb893f4"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"

[compat]
ReTestItems = "1"

[extras]
DeepDiffs = "ab62b9b5-e342-54a8-a765-a90f495de1a6"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
ReTestItems = "817f1d60-ba6b-4fd5-9520-3cf149f6a823"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["DeepDiffs", "JSON3", "ReTestItems", "Test"]

note the manifest = "../../Manifest.toml" entry

And then you add and then remove a package

] activate Foo
] add Example
] rm Example

which should leave the Project.toml (packages/Foo/Project.toml) and Manifest.toml (../../Manifest.toml) without any changes

But we see

(Foo) pkg> add Example
   Resolving package versions...
    Updating `~/packages/Foo/Project.toml`
  [7876af07] + Example v0.5.3
    Updating `~/Manifest.toml`
  [7876af07] + Example v0.5.3

(Foo) pkg> rm Example
    Updating `~/packages/Foo/Project.toml`
  [7876af07] - Example v0.5.3
  No Changes to `~/Manifest.toml`

And the Manifest.toml is left with a diff like:

diff --git a/Manifest.toml b/Manifest.toml
index 1311df8842..2042e8dd9d 100644
--- a/Manifest.toml
+++ b/Manifest.toml
@@ -2,7 +2,7 @@
 
 julia_version = "1.9.2"
 manifest_format = "2.0"
-project_hash = "53c4ec67dcb0841eab26478fa1ef6c1836f9ee8b"
+project_hash = "c42550b13eba1529c8ab6377082cae8993859c62"
 
 [[deps.ANSIColoredPrinters]]
 git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
@@ -497,6 +497,11 @@ git-tree-sha1 = "bdb1942cd4c45e3c678fd11569d5cccd80976237"
 uuid = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
 version = "1.0.4"
 
+[[deps.Example]]
+git-tree-sha1 = "46e44e869b4d90b96bd8ed1fdcf32244fddfb6cc"
+uuid = "7876af07-990d-54b4-ab0e-23690620f79a"
+version = "0.5.3"
+
 [[deps.ExceptionUnwrapping]]
 deps = ["Test"]
 git-tree-sha1 = "e90caa41f5a86296e014e148ee061bd6c3edec96"
@@ -1632,7 +1637,7 @@ uuid = "66d59315-31dc-41c8-b200-e39bcbf712f1"
 version = "0.1.0"
 
 [[deps.Foo]]
-deps = ["Compat", "ContextVariablesX", "Dates", "ExceptionUnwrapping", "JSON", "Logging"]
+deps = ["Compat", "ContextVariablesX", "Dates", "Example", "ExceptionUnwrapping", "JSON", "Logging"]
 path = "packages/Foo"
 uuid = "801270c1-6d38-4c07-85b6-74a2f576d89a"
 version = "0.1.0"

Which has the issue:

@NHDaly
Copy link
Member

NHDaly commented Aug 17, 2023

@nickrobinson251 after #3579, issue 1. is addressed, right? Should you update this ticket to only cover issue 2.?

That is, this part of the diff is no longer present after #3579, right?:

 [[deps.Foo]]
-deps = ["Compat", "ContextVariablesX", "Dates", "ExceptionUnwrapping", "JSON", "Logging"]
+deps = ["Compat", "ContextVariablesX", "Dates", "Example", "ExceptionUnwrapping", "JSON", "Logging"]
 path = "packages/Foo"
 uuid = "801270c1-6d38-4c07-85b6-74a2f576d89a"
 version = "0.1.0"

@nickrobinson251
Copy link
Contributor Author

yeah - updated - thanks

@KristofferC
Copy link
Member

This is a bit of an inherent drawback with the current manifest = system that exist in Pkg in that it doesn't take into account any other projects that have a manifest = entry that points to the same manifest. In order to be "safe" it therefore never removes any packages from the manifest since it could be so that other projects are using it. A full "sub project" implementation would consider that.

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

No branches or pull requests

3 participants