Julia development workflow

I am writing a package in Julia from scratch, and am trying to figure out what the optimal workflow is. (Apologies if this is described somewhere in the documentation)

Note that it is still very much in development, so I do not want to publish it yet using PkgDev.

Right now, every time I change something in the source code, I run

workspace(); include("src/mypackage.jl")

which precompiles the whole thing again. If I don’t include workspace() and just include the package again, sometimes the package does not actually update.

This also requires the package to be pre-compiled every time I restart julia.

Is this the most efficient way to develop a package? Or are there better methods which only recompile the functions that changed (and anything that depends on those)?

1 Like

Check this:

7 Likes

https://tpapp.github.io/post/julia-workflow/

2 Likes

and atom-julia-client/workflow.md at master · JunoLab/atom-julia-client · GitHub

2 Likes

Also, the latest Julia VSCode extension has a “Reload imported modules” option which I’m guessing should do what you want (probably using Revise under the hood).

All great replies, thanks!

And once the package is in a stable state, how do I ensure that the module is pre-compiled – in the same way as a package that is installed using Pkg.add()? Such that it doesn’t recompile every time I open julia and include the module using include("src/mypackage.jl"). I added __precompile__() to the top of this file, but that does not seem to work between julia sessions.

I haven’t quite figured out if I want to add this package using PkgDev().