# Managing larger project in Julia

**URL:** https://discourse.julialang.org/t/managing-larger-project-in-julia/44413
**Category:** New to Julia
**Tags:** question
**Created:** [August 6, 2020, 11:19am UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413 "2020-08-06T11:19:50Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![musman](https://avatars.discourse-cdn.com/v4/letter/m/53a042/32.png) [@musman](https://discourse.julialang.org/u/musman)
#### Post date: [August 6, 2020, 11:19am UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/1 "2020-08-06T11:19:50Z")

</div>

Hi,

Coming from the MATLAB background where a large project can be handled pretty easily by calling out all the other functions, which are written in separate .m files, into a Main.m file (the name Main is arbitrary) and then executing just the Main.m file. I am wondering on these lines what is the best way of handling such a large project in Julia?

---

<div class="post-metadata">

### Author: ![fbanning](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fbanning/32/14972_2.png) [@fbanning](https://discourse.julialang.org/u/fbanning)
#### Post date: [August 6, 2020, 11:25am UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/2 "2020-08-06T11:25:30Z")

</div>

I think you’re looking for the `modules` functionality (and specifically the `export`, `using` and `import` keywords). Look it up [here](https://docs.julialang.org/en/v1/manual/modules/#modules-1).

---

<div class="post-metadata">

### Author: ![dmolina](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dmolina/32/5246_2.png) [@dmolina](https://discourse.julialang.org/u/dmolina)
#### Post date: [August 6, 2020, 11:31am UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/3 "2020-08-06T11:31:48Z")

</div>

You can divide the functions in files as you want, you have not to follow the typical division in MATLAB, unless you like it 😉.

You can include functions defined in another function “otherfile.jl” simple using:

```julia
include("firstfile.jl")
include("otherfile.jl")

```

It is typical to divide the functions in several files, not exactly one file for function, and a file that include all implemented functions using include.

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [August 6, 2020, 1:45pm UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/4 "2020-08-06T13:45:36Z")

</div>

I haven’t used MATLAB since I think 2013b, but I’d say that managing larger projects is one of the areas where Julia really shines in comparison.

As @dmolina says, the key difference is that you don’t have to divide your code into loads of separate `.m` files, but can rather organise it in a way that groups functionality that belongs together into different `.jl` files.

For larger projects it often makes sense to also organise your work as a package - see the documentation here: [5. Creating Packages · Pkg.jl](https://julialang.github.io/Pkg.jl/v1/creating-packages/). This gives you benefits in terms of reproducibility (as you’ll have a `Manifest.toml` file that records the exact versions of all dependencies of your work) and nudges you towards writing tests for the functions in your codebase (if you use something like [User Guide · PkgTemplates.jl](https://invenia.github.io/PkgTemplates.jl/stable/user/) you get test infrastructure and CI set up as well).

---

<div class="post-metadata">

### Author: ![lostella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lostella/32/356_2.png) [@lostella](https://discourse.julialang.org/u/lostella)
#### Post date: [August 6, 2020, 2:48pm UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/5 "2020-08-06T14:48:08Z")

</div>

> [@nilshg](#):
>
> For larger projects it often makes sense to also organise your work as a package - see the documentation here: [https://julialang.github.io/Pkg.jl/v1/creating-packages/](https://julialang.github.io/Pkg.jl/v1/creating-packages/). This gives you benefits in terms of reproducibility (as you’ll have a `Manifest.toml` file that records the exact versions of all dependencies of your work)

To be precise, in order to get the reproducibility benefit you need to use project environments, see here: [Code Loading · The Julia Language](https://docs.julialang.org/en/v1/manual/code-loading/#Environments-1)

In fact, packages don’t usually come with the Manifest file

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [August 6, 2020, 3:17pm UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/6 "2020-08-06T15:17:07Z")

</div>

Agreed, there is a step that I suppose can be seen as a in between just a throwaway script and a package, which is a project with its own environment.

I’m not sure why you think packages don’t come with a Manifest file? As is explained in the [`Pkg.jl` docs here](https://julialang.github.io/Pkg.jl/v1/creating-packages/) if you `] generate` a package and then `] add` some other package to your package, the dependencies will get added to the `Manifest.toml`. Or are you referring to the fact that usually public packages don’t come with a manifest, just the `Project.toml` for direct dependencies?

---

<div class="post-metadata">

### Author: ![lostella](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lostella/32/356_2.png) [@lostella](https://discourse.julialang.org/u/lostella)
#### Post date: [August 6, 2020, 3:22pm UTC](https://discourse.julialang.org/t/managing-larger-project-in-julia/44413/7 "2020-08-06T15:22:27Z")

</div>

> [@nilshg](#):
>
> Or are you referring to the fact that usually public packages don’t come with a manifest, just the `Project.toml` for direct dependencies?

Yes, sorry, that’s exactly what I meant: packages are not _distributed_ with a Manifest (but you can definitely make one)
