Reproducible simulations in a tarball with toml-file

We have a use-case which should not be totally uncommon: We have a couple of julia scripts that illustrate / simulate something in a research paper. In our case it reproduces some figures in the paper. In order for a reader to easily try out the script, we want to provide it as a tar-ball on a web-page (our own web page, not a github). The correct package versions is crucial. Someone indicated that the right way to do get the right package version is with toml-files.

  1. Given a script, how can I generate toml-files with the requirements of what it runs. Since the goal is reproducibility, the exact version number of the current packages would probably be the best choice. I would prefer not to have edit toml-files by hand.

  2. How does a reader of the paper install exactly the same versions of the packages as specified in the toml-file?

The toml files are generated by the usual pkg commands : add, etc. Your use case is exactly what project environments are made for:

https://julialang.github.io/Pkg.jl/v1/environments/

2 Likes

I’d recommend spending a little bit of time and wrap your project in DrWatson.jl which was made exactly for this purpose. In the documentation you also find a very nice overview how such a project can be initialised with ease.

But in general, yes, a Project.toml will describe the environment and the dependencies and a Manifest.toml will even set each of them to a very specific version, so your environment will be fully reproducible.

Here is a quick tutorial in the DrWatson docs, it’s really easy to set it up: https://juliadynamics.github.io/DrWatson.jl/dev/workflow/

4 Likes

Thanks. DrWatson does indeed seems to do exactly this and a bit more.

1 Like