I have written some Julia packages that depend on each other. To make it simple, suppose A.jl
depends on B.jl
. I have added B
to my Project.toml
and Manifest.toml
files, and both packages (must) live on a private Git repository. Now, I have updated B
, and on my dev host I have updated A
’s environment so that it now contains the appropriate git-tree-sha1
and repo-rev
for it. What command can I issue on the production host (after updating git) that would trigger the fetching and updating of B on the host environment?
As I understand it, the answer is Pkg.rm
followed by Pkg.add
(see How to activate a package in a script? - #19 by fredrikekre).
However, I find it easier to roll my own package registry. Then I just need to make a blank environment on the remote and issue Pkg.add(A)
.
I didn’t quite get it. Should I rm/add
package A
or package B
? Since B
is already installed, would it be updated upon re-adding A
? Is this clearly documented somewhere?
Also, I’d rather not have an “install” script for my code, and rely on Pkg
’s ability to resolve dependencies, because if somehow B
now depends on C
, then A
would have to know that as well. It was probably not clear from my first message, but I want a precise commit for B
(for reproducibility, among other things), so “the most recent” doesn’t work.
I’ll look into that, it seemed overkill a while ago, but maybe it’s the right thing here. Also, for the rest of our devs (and my 2 other computers…), I’d prefer not to need to reinstall everything on a new environment each time our packages update, but just something along the lines of (I’d might have gotten it wrong)
$ git fetch
$ git rebase
$ julia --project=. "using Pkg; Pkg.update()"
It’s complicated… and not really documented anywhere as far as I can tell.
As for making a registry, see Creating a custom registry. This worked for me.
For unregistered dependencies, Pkg
cannot track the chain of dependencies (this is issue 810). So you need to add unregistered dependencies “by hand” in the right order. For example, if A depends on B depends on C, you need to add C first, then B.
If you want to add a package with a specific commit (rather than the latest), I believe you can specify the the git sha in the PackageSpec
and then use add
(I have not tested this, though). But you would still have an install script - I don’t see a way around this without a registry.
But please take what I am saying with more than a grain of salt. I’m not an expert, which is why I pointed you to the “How to activate” thread where more knowledgeable people chimed in.
PS: In case it’s useful, I write up what I have figured out here (precisely b/c I have trouble finding documentation on workflow issues and also following the various threads on discourse. Perhaps useful.