0.7 Pkg: how to make projects aware of each other


#1

Pkg for 0.7-alpha: There is some discussion in the documentation how to add packages using git. The problem is, at the moment this doesn’t work on Windows 10 (some system-level bug).

So how do I set up two projects in my working folder and then make them aware of each other. Let us say I set up project A and B (with Pkg command generate). Then I want to work in the directory B and do using A. How do I make Julia aware of the location of these two projects? The documentation is at the moment silent on this topic.

Thanks.


#2

One way or another each project needs to have its dependencies to its Project.toml in order to work (at, least, this is my current understanding). Are you saying that if you do add PackageName this fails because of a git error on Windows? If that’s the case I think you can at least move your packages into .julia/dev and then do develop PackageName on each package. It will still try to talk to git and fail, but if it successfully adds the packages to the environment it’ll still work because it still ought to just look for them in dev.


#3

What fails is to do
add https://github.com/PetrKryslUCSD/FinEtools.jl.git

An issue has been filed. In the meantime I will try your trick with dev.


#4

For exampe:

➜  ~ mkdir MyProject
➜  ~ cd MyProject
➜  MyProject ~/julia/julia

(v0.7) pkg> generate A; generate B
Generating project A:
    A/Project.toml
    A/src/A.jl
Generating project B:
    B/Project.toml
    B/src/B.jl

shell> cd B
/Users/kristoffer/MyProject/B

(B) pkg> dev ../A
 Resolving package versions...
  Updating `Project.toml`
  [08b160a6] + A v0.1.0 [`~/MyProject/A`]
  Updating `Manifest.toml`
  [08b160a6] + A v0.1.0 [`~/MyProject/A`]

Now you can load A in B.


#5

Fantastic. I hope this example will make it into the documentation of Pkg!


#6

There is some docs for dev in the REPL mode

pkg> help dev
  develop pkg[=uuid] [#rev] ...

  Make a package available for development. If pkg is an existing local path that path will be recorded in the manifest and used.
  [...]

Perhaps it is not clear enough.


#7

OK, now I follow that sentence. Thanks. The example would be nice though.
Also: does it also follow that one should be able to do add pkg where pkg is a local path?


#8

If you have the location information in the manifest file(s), how can you do something like switch things from loading from a network version to a local version?
I see in the manifest something like “https://github.com/JuliaString/…”, but now want to switch all of them to load from my local directory “/s/…” instead, how can that be accomplished easily?
(Preferably, without modifying those files back and forth)


#9

The manifest is what tells julia what to load so that has to be modified. dev tells it to put a psth entry in the free says to take it away and start tracking the registry again.


#10

Nice, this works fine!

Why does it have to be dev and not add? I tried with add, but I got complaints about git…

Thanks again.


#11

OK, then I think it would be a useful capability to be able to switch manifests between local and remote without having to update the files themselves, not just for development.
This is something that comes up frequently when normally you might want to pull files from github, but if you are off-line, use a local copy only.