Skip to content

Commit 8576a4b

Browse files
committed
Add packaging
1 parent ff40dbf commit 8576a4b

File tree

2 files changed

+54
-3
lines changed

2 files changed

+54
-3
lines changed

presentations/intro-julia/Project.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
[deps]
22
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf"
33
ChunkSplitters = "ae650224-84b6-46f8-82ea-d812ca08434e"
4+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
5+
Profile = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
6+
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
7+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
48
quarto_jll = "b7163347-bfae-5fd9-aba4-19f139889d78"
59

610
[compat]

presentations/intro-julia/index.qmd

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ format:
1616
useTextContentForMissingTitles: false
1717
preview-links: true
1818
slide-number: true
19+
toc: true
20+
toc-depth: 1
1921
theme: [solarized, custom.scss]
2022
transition: fade
2123
date: 2025-11-16
@@ -132,7 +134,7 @@ play(Rock(), Paper())
132134

133135
# Arrays and <br> Linear Algebra
134136

135-
## Arrays
137+
## Arrays{.scrollable}
136138

137139
Julia has built-in support for multi-dimensional tensors:
138140

@@ -478,6 +480,53 @@ v = randn(20_000_000);
478480
479481
# Good practices
480482
483+
## Packaging
484+
485+
Julia has a built-in package manager:
486+
487+
```julia
488+
julia> # Press ] to enter the Pkg REPL mode
489+
490+
(@v1.12) pkg> activate MyLocalEnvironment
491+
Activating new project at `/private/tmp/MyLocalEnvironment`
492+
493+
(MyLocalEnvironment) pkg> add Example
494+
Updating registry at `/var/folders/v2/hmy3kzgj4tb3xsy8qkltxd0r0000gn/T/tmp.tmYxNNrwBP/registries/General.toml`
495+
Resolving package versions...
496+
Installed Example ─ v0.5.5
497+
Updating `/private/tmp/MyLocalEnvironment/Project.toml`
498+
[7876af07] + Example v0.5.5
499+
Updating `/private/tmp/MyLocalEnvironment/Manifest.toml`
500+
[7876af07] + Example v0.5.5
501+
Precompiling packages finished.
502+
1 dependency successfully precompiled in 1 seconds
503+
504+
(MyLocalEnvironment) pkg> status
505+
Status `/private/tmp/MyLocalEnvironment/Project.toml`
506+
[7876af07] Example v0.5.5
507+
```
508+
509+
## Virtual environments
510+
511+
Virtual environments are defined by two files:
512+
513+
* `Project.toml`: only top-level dependencies, with compatibility specifications (automatically generated by Pkg, but can be edited by users)
514+
* `Manifest.toml`: full snapshot of all packages in the environment, for reproducibility (fully machine-generated, do not touch it)
515+
516+
## Virtual environments (cont.)
517+
518+
`Project.toml`:
519+
````{.toml}
520+
{{< include Project.toml >}}
521+
````
522+
523+
## Virtual environments (cont.)
524+
525+
`Manifest.toml`:
526+
````{.toml}
527+
{{< include Manifest.toml >}}
528+
````
529+
481530
## Testing
482531
483532
```{julia}
@@ -494,8 +543,6 @@ using Test, Random
494543
end;
495544
```
496545
497-
## Packaging
498-
499546
# Conclusions
500547
501548
## Further resources

0 commit comments

Comments
 (0)