Is Manifest.toml "write only"?

Starting from .toml files mentioned in a bug post,
I did a Pkg.activate(".") and Pkg.instantiate().
It added the packages mentioned in Project.toml

but not the ones in Manifest.toml.

Further (this surprised me), when I munually add a package listed in the manifest,
it did not respect the version listed there but instead downloaded the newest version
(and updated the manifest, thereyb destroying the “correct” version).

Is this the correct behaviour? Is there a way to cause all the packages
in the manifest to be added (other than doing it manually)?

Whenever you add a package, all the dependencies will be installed, but you can’t using them unless/until you explicitly add them.
For example, BenchmarkTools.jl’s Project.toml:

[deps]
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

If you install BenchmarkTools, you’ll be able to use it.
JSON and Printf will not show up in st even though the package manager will download them, and using JSON and using Printf will fail.
But BenchmarkTools will work.

If a future version of BenchmarkTools no longer depends on these, they can be removed.
For that reason at least, the above makes sense: if you depend on JSON or Printf, you should explicitly add them to your project, so that they show up in your Project.toml.

2 Likes

One way to check the dependencies of BenchmarkTools for example is

(v1.2) pkg> st -m BenchmarkTools
    Status `~/.julia/environments/v1.2/Manifest.toml`
  [6e4b80f9] BenchmarkTools v0.4.3
  [682c06a0] JSON v0.21.0
  [de0858da] Printf 
  [10745b16] Statistics

This lists the environment of BenchmarkTools, and not the default one that you’re installing packages into. The latter can be checked using pks> st.

When you install new packages, julia checks the the compatibilities across other packages that you have in the active environment. If all the packages have their [compat] listed correctly, you’ll not be able to upgrade to a broken state. Upgrades will get the newest versions of all packages such that you end up with a consistent setup.

1 Like