I am using the new
Pkg setup for projects, ie bundles of code which are not necessarily packaged, but serve the a specific purpose (eg accompany a paper). I have some clarifying questions about the workflow.
I set up the directory structure like
ThisProject.jl # which has "module ThisProject ... end"
Is it OK if I don’t
dev this project in the global environment, just use
shell> cd to/ThisProject/
pkg> activate .
when I am working on it? It seems to work fine so far.
Having things in a module is convenient because of
Revise.jl. Can I have multiple modules though, or do they have to be submodules of the same module? How should I set up the files?
from this active project, can I rely on the package versions being unchanged, because they are in
Manifest.toml (which is in version control, so I can always reproduce my environment)?
Yes, that is the intended workflow.
You can have subpackages inside the project that you dev, but Revise can also track files that are just
Dependencies of dependencies could update on
add unless you pin them (due to https://github.com/JuliaLang/Pkg.jl/issues/211). But with the Manifest you can recreate the exact versions, yes.
Just to clarify the subpackages,
- is there a 1-to-1 correspondence between modules and packages as far as loading is concerned? Eg I cannot have
- for the
dev, I would need to set up a hierachy like
dev ./misc/OtherModule, or is it simpler than this?
You would have to do as 2 if you want them to be separate packages and be individually loadable.
If you want to provide two modules from the same package, you can make them both submodules of the main package module.