-
Notifications
You must be signed in to change notification settings - Fork 38
Julia package manager
The Julia package manager (Pkg
) is used to install and manage sets of packages. It is important to first read the manual of the package manager. Pkg
is very powerful, but on the other hand also quite complicated when starting with it. Below additional hints are given that might otherwise not easy to deduce:
-
The package manager defines versions of packages with the Project.toml and Manifest.toml files. It might be necessary to define in the Project.toml file (in a section
[compat]
) that the package requires Julia 1.1 or later, or that a later version of another package is required. Example:[compat] julia = "1.1"
-
A very basic property is that for every Pkg-environment, exactly one version of a package is used. For example, if an environment contains two packages A and B, and in the Manifest.toml file of package A it is stated that version v1 or later of package C is required and in the Manifest.toml file of package B it is stated that version v2 or later of package C is required, and the latest registered version of package C is version v3, then the package manager installs exactly one version of C (it could be v1, v2, or v3, or another version). With
]status
the actually used package versions of the default environment are listed. Note, the Project.toml and Manifest.toml files of a package A are just yet another environment and whatever is stated inA/Manifest.toml
is ignored if package A is used in another environment, such as the default environmentv1.0
.
- Make sure that the current directory is not
.julia/dev
(you can change directory with the commandcd("<directory-name>")
). -
]add A
will install the latest registered version of a released package A.
- Use git to clone the desired branch (usually
master
) into directory.julia/dev
. For example, clone package A to.julia/dev/A
. - Best to change to the
dev
directory. For example:cd("C:/Users/name/.julia/dev")
. - If
A
is already in the environment, it might be best to first remove it:]remove A
. -
]dev <full-path-name-of-A>
will make the development version of A available. For example, if A is in directoryC:\Users\name\.julia\dev\A
, then use the command]dev C:\Users\name\.julia\dev\A
. - Exactly the source code that is present in
.julia\dev\A
will be used in the Julia session. Whenever changes to this source code are made (either directly changing some files, or by switching to another branch), then this modified source code is used in the next Julia session. So, Julia has to be terminated withexit()
, and then restarted, and then the actual files of.julia\dev\A
are used.