RFC allow packages to fall back to finding UUID in project if not in deps of manifest #27932
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A common developer situation is that you have a project with a bunch of dependencies. You are working on the dependencies and want to add a dependency to one of them.
As a concrete example, let's say I have:
Now, I want to use
ExampleinJSON.The current steps to properly do this before
JSONcan be loaded is:import ExampletoJSON.JSONproject your active project.Pkg.add("Example")to updateProject.tomlinJSON(this could potentially fail due to some weird constraints in the Manifest file in the JSON project)Pkg.resolve()to update the main project'sManifest.toml, which looks at JSON'sProject.toml(populatedeps = ["Example"]forJSON).JSON.Arguably, the steps 2-5 is kinda annoying while you are in the heat of developing. The reason we need to lookup the
depssection in the Manifest is because `JSON´ could potentially have used another package (another UUID) that also had the name Example. However, sometimes the Project.toml Example is the only package with that name in the Manifest, and it is likely that that is the package that one wanted to load into JSON anyway. So it feels a bit cruel to not allow it to just be loaded.This PR instead makes the workflow:
import ExampletoJSON.JSON.with the result
So it is quite clear that something wrong is happening but you can still continue working.
There are of course other solutions to this issue:
pkg> add JSON:Example; resolve)The current implementation is not perfect. It will look for fallback packages in environments below you in the stack which is perhaps not wanted. Also, maybe this should only be enabled for packages that are in "developer mode", i.e. tracking a path.
cc @Keno, @stevengj who has been "bitten" by this issue, cc @StefanKarpinski