Hello, I have a basic question about the usage of
activate projects in julia 1.0.
I have a git repository for my research where I have modules and scripts written in julia.
The tree looks somethin like this:
│ └── subfolder1
│ ├── script1.jl
│ └── script2.jl
I write the code on two different machines and I also want to be able to run it on different machines. To have as little differences in julia on the different machines as possible I would like to use the same environment.
Now, my idea was to activate a project in the root folder and then add `Pkg.activate(“path/to/root”) in each script. (I run the scripts from different levels of the directory tree separately).
Is this the right way to go?
I usually have the following directory layout for research code:
|--- ... other languages, eg stata, R
ie with a single module, which contains a
Root path of the project. Useful for organizing results, plots, data, etc.
project_path(parts...) = normpath(joinpath(@__DIR__, "..", parts...))
or similar for relative paths.
I only activate the
./julia/ directory for the project.
Having multiple modules is tricky AFAIK. I use submodules.
You could also reorganize the module files into actual packages, i.e. run Julia in the
Modules directory and do
(v1.0) pkg> generate Module1
and likewise for the other modules. Copy
Modules/Module1/src. Then run Julia from the root directory of the project,
(v1.0) pkg> activate .
(root) pkg> dev Modules/Module1
Manifest.toml will just store a relative path:
path = "Modules/Module1"
uuid = "98c17f10-c264-11e8-1c5a-bd2cf0ea0803"
version = "0.1.0"
making this approach portable.
Thanks for the suggestions. I will try out and look what fits best to my needs