Project environment

I have defined a project environment. One of the packages is listed in the Manifest file as

[[H2Libjl]]
deps = ["Arpack", "DelimitedFiles", "Distributed", "FinEtools", "JSON", "Libdl", "LinearAlgebra", "Random", "SparseArrays", "Statistics", "Test"]
git-tree-sha1 = "1678c91a081de4d0d92ad0a420c40e0147d6cccf"
repo-rev = "master"
repo-url = "https://gitlab.com/PetrKrysl/H2Libjl.jl.git"
uuid = "68c9da36-1c06-11e9-0d8d-e1acd994ec4d"
version = "0.1.0"

It seems to me that a particular git “state” is indicated (the git-tree-sha1). If that is correct, and this requests one particular state of the repo on the master, how do I always get the latest version from that git repo instead?

As far as I understand, the Manifest.toml file does not specify the project requirements, but rather states the exact versions of packages in the project as you have it instantiated. Package requirements are instead listed in the Project.toml.

2 Likes

Project.toml only states H2Libjl = "68c9da36-1c06-11e9-0d8d-e1acd994ec4d" (uuid).

If nothing is mentioned about that package in the [compat] section of Project.toml then I guess any version is admissible. In any case, if you simply invoke

] up

from the REPL when the environment is active, you’ll get the latest compatible (as prescribed by Project.toml) version of all packages.

1 Like

That was really my point: The Manifest file instructs Julia to install one particular commit of the H2Libjl package. When I run ]up I do get an update from the H2Libjl library in the form of the latest commit. I would like to get that latest commit by default by specifying THAT in the Manifest file. Does it make sense?

What do you mean by “by default”? When do you want the package to update if not on up?

I would just like to get the latest commit of H2Libjl by specifying that it is the latest commit in the Manifest file. Obviously I will not know the sha. I would like to say “get me the latest”, so that I don’t have to do “update” on that package.

I think I am misunderstanding. Isn’t up the command which says “get me the latest”?

Ah, are you looking for pkg> add H2Libjl#commit? i.e. specifying the commit directly instead of a branch?

I tried add https://gitlab.com/PetrKrysl/H2Libjl.jl.git#commit . That didn’t work.

I think the Manifest is not to be touched directly, it just lists what is there. When you update a package in the environment, the corresponding lines in the Manifest will be updated.

When instantiating an environment, the package versions are taken from the Manifest (with their exact version) if present, and from the Project (latest compatible version) otherwise.

So I would say, just keep the Manifest local to your environment and don’t share it, so whoever fetches your project and instantiates it (which may be yourself too) will get the latest versions of packages.

See: 4. Working with Environments · Pkg.jl

My motivation really was to share the Manifest file so that everyone who collaborated on the project would get precisely the same versions of the packages as everyone else.

Except that for the library H2Libjl I would like everybody to get the latest commit, not just some particular fixed commit in the past.

I see. Then my guess is that you should be fixing the versions in the Project files using the compat section, and leaving that particular one unbounded.

You can tell them to pkg> up H2Libjl.

2 Likes

Oh well. It would have been nice if they could just say “]activate .; instantiate”. But I guess one can’t have EVERYTHING…

Well, the point of pkg> activate; instantiate is to get the exact same thing, not maybe the same thing.

1 Like

Maybe the suggestion here is: Share the project.toml file with your colleagues, not the manifest.toml?

I think the idea is to have the same explicit environment (except for one thing). That’s what the Manifest.toml is great for.

commit here is supposed to be a Git commit SHA, not literally the word ‘commit’.

For sure. It did not work, as I found out after I posted, because I copied the wrong sha.

1 Like