# Configure a Project which should run on different machines

**URL:** https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546
**Category:** New to Julia
**Tags:** question
**Created:** [September 27, 2018, 7:09am UTC](https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546 "2018-09-27T07:09:55Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)
#### Post date: [September 27, 2018, 7:09am UTC](https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546/1 "2018-09-27T07:09:55Z")

</div>

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:

```julia
.
├── folder1
│ └── subfolder1
│ ├── script1.jl
│ └── script2.jl
└── Modules
    ├── Module1.jl
    └── Module2.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?

---

<div class="post-metadata">

### Author: ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)
#### Post date: [September 27, 2018, 9:37am UTC](https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546/2 "2018-09-27T09:37:31Z")

</div>

I usually have the following directory layout for research code:

```nohighlight
.
|--- paper
|
|--- ... other languages, eg stata, R
|
|--- slides
|
|--- ...
|
|--- julia
     |
     |- Project.toml
     |- src/ProjectModule.jl
     |- test/...
     |- scripts/...
     ...

```

ie with a single module, which contains a

```julia
"""
    $SIGNATURES

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.

---

<div class="post-metadata">

### Author: ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)
#### Post date: [September 27, 2018, 2:56pm UTC](https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546/3 "2018-09-27T14:56:08Z")

</div>

You could also reorganize the module files into actual packages, i.e. run Julia in the `Modules` directory and do

```julia
(v1.0) pkg> generate Module1

```

and likewise for the other modules. Copy `Module1.jl` to `Modules/Module1/src`. Then run Julia from the root directory of the project,

```julia
(v1.0) pkg> activate .

```

and then

```julia
(root) pkg> dev Modules/Module1

```

The `Manifest.toml` will just store a relative path:

```nohighlight
[[Module1]]
path = "Modules/Module1"
uuid = "98c17f10-c264-11e8-1c5a-bd2cf0ea0803"
version = "0.1.0"

```

making this approach portable.

---

<div class="post-metadata">

### Author: ![stakaz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stakaz/32/4740_2.png) [@stakaz](https://discourse.julialang.org/u/stakaz)
#### Post date: [September 28, 2018, 8:15am UTC](https://discourse.julialang.org/t/configure-a-project-which-should-run-on-different-machines/15546/4 "2018-09-28T08:15:58Z")

</div>

Thanks for the suggestions. I will try out and look what fits best to my needs 😉
