When I was developing my first ever Julia
package (LRMoE.jl), I did not have the best experience, as I was also struggling with submitting the package and its accompanying paper on a tight deadline.
Now that I have a bit more experience with the language, I have learned about some useful ideas and tools for package development in Julia.
In general, it is a good idea to assemble your code into a package, whenever it grows beyond just a few functions. It would be much better for reusability and reproducibility.
A useful tool for Julia
package development is PkgTemplates.jl, which helps with the initial setup quite effectively. A useful guide is given here.
Packages require testing: otherwise no one will know if the code is working as intended.
While it is important to use CI/CD tools for testing, it is equally important to run the tests locally before pushing to GitHub (otherwise you will have to wait for the CI/CD to finish, and you may exceed certain usage limits). This is in fact very easy by following the guide here. In short, just activate the package environment, and do pkg> test
.
For research purposes, I know there is s struggle and balance between writing good code and getting preliminary results faster (in order to make the deadlines). In this setting, the package DrWatson.jl
is a god-tier tool, which helps with organizing the code and the results very efficiently, and makes it extremely easy to share with collaborators (even if they are not that familiar with Julia
per se). Personally, I prefer writing small modules in the src
folder during initial experimentations, after which they can be easily converted to a package if needed.