Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
courses
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
R3
school
courses
Merge requests
!131
julia training slides for 2022-06-08
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
julia training slides for 2022-06-08
mk-juliatraining
into
develop
Overview
1
Commits
11
Pipelines
0
Changes
4
Merged
Miroslav Kratochvil
requested to merge
mk-juliatraining
into
develop
2 years ago
Overview
1
Commits
11
Pipelines
0
Changes
4
Expand
opening early, there's still a tiny bit of TODOs
Guess this is valid as a 1st draft now
Edited
2 years ago
by
Miroslav Kratochvil
0
0
Merge request reports
Viewing commit
6abcf0b2
Prev
Next
Show latest version
4 files
+
57
−
16
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
4
Search (e.g. *.vue) (Ctrl+P)
6abcf0b2
updates
· 6abcf0b2
Miroslav Kratochvil
authored
2 years ago
2022/2022-06-08_JuliaForNewcomers/slides/bootstrap.md
0 → 100644
+
142
−
0
Options
<div
class=
leader
>
<i
class=
"twa twa-axe"
></i><i
class=
"twa twa-carpentry-saw"
></i><i
class=
"twa twa-screwdriver"
></i><i
class=
"twa twa-wrench"
></i><i
class=
"twa twa-hammer"
></i><br>
Bootstrapping Julia
</div>
# Installing Julia
Recommended method:
-
Download an archive from https://julialang.org/downloads/
-
Execute
`julia`
or
`julia.exe`
as-is
-
Link it to your
`$PATH`
Distribution packages usually work well too:
-
**Debians&Ubuntus**
:
`apt install julia`
-
**Iris/Aion**
:
`module add lang/Julia`
# Life in REPL
```
julia
user
@pc
$
julia
julia
>
sqrt
(
1
+
1
)
1.4142135623730951
julia
>
println
(
"Well hello there!"
)
Well
hello
there!
julia
>
?
help
?>
sqrt
sqrt
(
x
)
Computes
the
square
root
.....
```
# REPL modes
Julia interprets some additional keys to make our life easier:
-
`?`
: help mode
-
`;`
: shell mode
-
`]`
: packaging mode (looks like a box!)
-
`Backspace`
: quits special mode
-
`Tab`
: autocomplete anything
-
`\`... `
Tab
`: expand math characters
# Managing packages from the package management environment
- Install a package
```julia
] add UnicodePlots
```
- Uninstall a package
```julia
] remove UnicodePlots
```
# Loading libraries, modules and packages
- Load a local file (with shared functions etc.)
```julia
include("mylibrary.jl")
```
- Load a package, add its exports to the global namespace
```julia
using UnicodePlots
```
# <i class="twa twa-light-bulb"> </i> How to write a standalone program?
*Your scripts should communicate well with the environment!*
(that means, among other, you)
```julia
#!/usr/bin/env julia
function process_file(filename)
@info "Processing $filename..."
# ... do something ...
if error_detected
@error "something terrible has happened"
exit(1)
end
end
for file in ARGS
process_file(file)
end
```
Correct processing of commandline arguments makes your scripts *repurposable*
and *configurable*.
# <i class="twa twa-light-bulb"></i> Workflow: Make a local environment for your script
- Enter a local project with separate package versions
```julia
] activate path/to/project
```
- Install dependencies of the local project
```julia
] instantiate
```
- Execute a script with the project environment
```sh
$ julia --project=path/to/project script.jl
```
(Project data is stored in `
Project.toml
`, `
Manifest.toml
`
.)
Loading