Yes, that’s right. And it could be laid out like that. But one of the advantages of the dev approach is that it doesn’t matter where you put the dependencies—you can structure it however you want to as long as various path entries point to the correct locations.
Yes, but you can also activate the packages themselves and add dependencies between them in the same way. For example, if PackageB depends on PackageA then you would cd into PackageB, activate it and do pkg> dev ../PackageA in order to add a dependency on PackageA.
No, a “Package Directory” is a directory containing package that is put into the load path. In this approach you do not modify the load path.
You were talking about doing this:
push!(LOAD_PATH, "PackageA")
push!(LOAD_PATH, "PackageB")
and so on for each dependency. This will not work because it would cause code loading to look for packages inside of the PackageA and PackageB directories, which is not where you would find them. What you would do if you were using this approach is simply push!(LOAD_PATH, ".") because the top-level directory is the “Package Directory”, ie a directory that contains packages (which are directories, typically).
Exactly.
Yes, in which case you are not using the Package Directory mechanism, you are putting the path to each dependency explicitly in each manifest that needs it.
Here’s the full layout of an example I generated:
MyProject:
Manifest.toml PackageA/ PackageB/ Project.toml
MyProject/PackageA:
Manifest.toml Project.toml src/
MyProject/PackageA/src:
PackageA.jl
MyProject/PackageB:
Manifest.toml Project.toml src/
MyProject/PackageB/src:
PackageB.jl
Example contents of various project and manifest files…
MyProject/Project.toml:
[deps]
PackageA = "2556dfe6-fba1-45c8-ae61-24ec43e93209"
PackageB = "f533fac8-037c-4ec8-a4c3-8f0aa0ff58a3"
MyProject/Manifest.toml:
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.2"
manifest_format = "2.0"
project_hash = "bd82cac20d9e29e79f49f82e3d4d848b38c6d981"
[[deps.PackageA]]
path = "PackageA"
uuid = "2556dfe6-fba1-45c8-ae61-24ec43e93209"
version = "0.1.0"
[[deps.PackageB]]
path = "PackageB"
uuid = "f533fac8-037c-4ec8-a4c3-8f0aa0ff58a3"
version = "0.1.0"
MyProject/PackageA/Project.toml:
name = "PackageA"
uuid = "2556dfe6-fba1-45c8-ae61-24ec43e93209"
authors = ["Stefan Karpinski <stefan@karpinski.org>"]
version = "0.1.0"
MyProject/PackageA/Manifest.toml:
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.2"
manifest_format = "2.0"
project_hash = "da39a3ee5e6b4b0d3255bfef95601890afd80709"
[deps]
MyProject/PackageB/Project.toml:
name = "PackageB"
uuid = "f533fac8-037c-4ec8-a4c3-8f0aa0ff58a3"
authors = ["Stefan Karpinski <stefan@karpinski.org>"]
version = "0.1.0"
[deps]
PackageA = "2556dfe6-fba1-45c8-ae61-24ec43e93209"
MyProject/PackageB/Manifest.toml:
# This file is machine-generated - editing it directly is not advised
julia_version = "1.11.2"
manifest_format = "2.0"
project_hash = "6d002591c1ced36dadf9d723d3ad71052e50f18d"
[[deps.PackageA]]
path = "../PackageA"
uuid = "2556dfe6-fba1-45c8-ae61-24ec43e93209"
version = "0.1.0"