-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpkg.qmd
36 lines (30 loc) · 1.69 KB
/
pkg.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
title: "Package management and reproducible environments"
engine: julia
julia:
exeflags: ["--project", "--threads=auto"]
---
*Julius Krumbiegel also has a [great blog post](https://jkrumbiegel.com/pages/2022-08-26-pkg-introduction/) with more details on Julia environments.*
Julia packages can be configured (in a file called `Project.toml`) on a per-project basis.
The packaged sources and compiled versions are stored in a central location, e.g. `~/.julia/packages` and `~/.julia/compiled` on Linux systems, but the configuration of packages to be used can be local to a project.
The `Pkg` package is used to modify the local project's configuration.
(An alternative is "package mode" in the read-eval-print-loop or REPL, which we will show at the summer school.)
Start julia in the directory of the cloned `SMLP2024` repository
```{julia}
#| eval: false
using Pkg # there's a package called 'Pkg' to manipulate package configs
Pkg.activate(".")# activate the current directory as the project
```
If you've received an environment from someone/somewhere else -- such as this course repository -- then you'll need to first "instantiate" it (i.e., install all the dependencies).
```{julia}
#| eval: false
Pkg.instantiate()# only needed the first time you work in a project
Pkg.update() # get the latest package versions compatible with the project
```
```{julia}
#| eval: false
Pkg.status()
```
Occasionally the `Pkg.status` function call will give info about new versions being available but blocked by requirements of other packages.
This is to be expected - the package system is large and the web of dependencies are complex.
Generally the Julia package system is very good at resolving dependencies.