-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathintro-pkg.qmd
More file actions
79 lines (63 loc) · 1.91 KB
/
intro-pkg.qmd
File metadata and controls
79 lines (63 loc) · 1.91 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
---
title: Introduction to the Package Manager
---
This is only a small glimpse into the Julia package manager.
For an in depth intro see [Pkg.jl and Julia Environments for Beginners](https://jkrumbiegel.com/pages/2022-08-26-pkg-introduction/).
## Essentials
- `add PackageName` - Install a package
- `rm PackageName` - Remove a package
- `up` or `update` - Update all packages
- `resolve` - Determine versions of all packages specified in Project.toml and Manifest.toml`
- `instantiate` - Install all packages from Project.toml
- `st` or `status` - Show installed packages
- `activate .` - Activate environment in current directory
- `?` - Get help
# REPL package manager mode
There are two ways to interact with the package manager.
Either programmatically by loading it in via `using Pkg` or by switching to the pkg mode in the REPL.
Here we will use the REPL mode.
To switch to the pkg mode use the closing square bracket.
```julia
]
```
This will switch the prompt of your REPL and now you can do package management tasks.
::: {.callout-note}
From now on we will assume you are in the pkg REPL mode
:::
- get some help
```julia
? # help
```
## Activating your environment
- Activate your
```julia
activate .
# You can use any path that is on your computer
```
- See what is installed
```julia
st # status
```
- Download all installed packages
```julia
instantiate
```
## Package handling
- Add a package
```julia
add Example
```
- Remove a package
```julia
rm Example
```
- Update packages
```julia
up
up PackageName
```
### Further reading
- [Pkg.jl documentation]()
- [Pkg.jl and Julia Environments for Beginners](https://jkrumbiegel.com/pages/2022-08-26-pkg-introduction/)
- [Modern Julia workflows on environments](https://modernjuliaworkflows.org/writing/#environments)
For a more in depth introduction and more tips and tricks see the [REPL Mastery workshop](https://github.com/miguelraz/REPLMasteryWorkshop) from JuliaCon 2022.