Skip to content

Building a dev environment

Léo Boisvert edited this page Apr 13, 2023 · 3 revisions

The happy path

To build a development environment, open a terminal in the root of the project, then follow these steps:

  1. SeaPearl.jl> julia
  2. julia> ]
  3. pkg> activate .
  4. pkg> instantiate

Tips for efficient development

Julia is a compiled language, which means on one hand it will run fast, but on the other hand it means that the code needs to be compiled. Compilation can take a lot of time and if you are not familiar with julia, it can make the whole development process very tedious. After a bit of trial and error -and frustration and despair, here are a couple tips to speedup your development process and environment:

  • Use Revise. Revise allows incremental compilation. This means that it will compile your source code along with your dependencies the first time you instantiate your environment, but afterwards, it will locate the parts of your code that have changed and will only recompile them. This leads to a big reduction in the development time. However, this means that Revise must be loaded before doing anything else. This is because it starts tracking changes from the moment it is loaded in the dev environment. To ensure that Revise is loaded FIRST THING, you can include it in your startup.jl file, which is a file that is being run every time you create a julia environment. Here is how you do it:

First, make sure you have installed the Revise.jl package:

julia> import Pkg
julia> Pkg.add("Revise")

Once this is done, identify the path where julia will look for the startup.jl file:

[path_to_current_dir]> julia
julia > joinpath(DEPOT_PATH[1], "config", "startup.jl")

This will print the path to the directory where the startup.jl file should be located. If it is not there -or if the config dir is missing altogether- then simply create the directory and create the startup.jl file. Then, add the following line to the startup.jl file:

using Revise

To confirm this works, open a julia environment and type the following command:

Revise.revise()

If you don't get an error, this means it works!

Troubleshooting

If something fails, try the following:

  1. Check your julia environment (you can see it at the bottom left in VSCode). Is this where you have these packages installed?
  2. Check your settings. You might have different versions of julia and maybe you are not using the right one.
  3. Delete the manifest.toml file, located at the root of the project and try again.