2

Say I have a project where I am performing analysis (ie not looking to develop a sharable package) but I want to ensure that others could clone the repository and instantiate the dependencies and run the code as written.

Steps I have taken so far:

  1. Created code in it's own folder
  2. Made that folder a Julia environment (by activate . in the package mode of the REPL)
  3. added the packages I am using

Does this lock in the versions of the dependencies? Or do I need to manually add [compat] entries to the Project.toml file? If the [compat] entreis are necessary, is there a way to auto-include that entry when adding the package?

Is there a overall approach to ensuring reporducability?

2 Answers 2

5

Does this lock in the versions of the dependencies?

If you commit your Project.toml and Manifest.toml then someone can clone the repo, activate that project and do import Pkg; Pkg.instantiate() to download the exact same versions as are recorded in the manifest.

3

Does this lock in the versions of the dependencies?

Yes, in the sense that the exact versions are recorded in the Manifest.toml file so as long as that file is not modified they are locked.

Or do I need to manually add [compat] entries to the Project.toml file?

You don't have to do this. This only matters when someone performs a package operation that invokes the resolver, for example pkg> add ... or pkg> up. If your code relies on some specific version of a package you can always add this to the [compat] section. For example, if you rely on a feature that requires package X version 1.3.0 you can add

[compat]
X = "1.3"

This will ensure that, even if someone invokes the package resolver, you will at least get version 1.3 of package X.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.