Skip to content

Commit 056f33c

Browse files
authored
Merge branch 'main' into git-trick-temp-branches
2 parents 07b60ee + e9ad1a8 commit 056f33c

File tree

11 files changed

+307
-383
lines changed

11 files changed

+307
-383
lines changed

01_version_control/my_favorite_neat_little_git_trick_demo.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
- Use `git switch -c <branch-name>` to create a new branch and immediately check it out!
2222
- Don't get stuck thinking that branches are only used as feature branches or issue branches! You can always create a short-lived temporary branch for something small, like shelving an experimental change.
2323
- If a temporary branch is still too much overhead for you, you can instantly stash your local changes with `git stash`. Restore your stashed changes later with `git stash pop`.
24+
- Prefer `git add -p` over `git add [FILE]`. This allows you to specify what you want to add to a commit in a more fine-grained manner
25+
- A very nice alias for editing any earlier commit, without having to manually rebase:
26+
27+
```
28+
[alias]
29+
amend = "!f() { \
30+
COMMIT=$(git rev-parse --short \"$1\") && \
31+
git commit --fixup \"$COMMIT\" && \
32+
GIT_SEQUENCE_EDITOR=true git rebase --autosquash --autostash --interactive "$COMMIT^"; \
33+
}; f"
34+
```
35+
36+
Usage: e.g. `git add -p ...` and then `git amend HEAD~5`. This would add the staged changes to the fifth last commit.
2437
2538
## Tricks from Winter Term 2024/25
2639

02_virtualization_and_containers/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,8 @@ Learning goals:
99

1010
| Duration | Content |
1111
| --- | --- |
12-
| 10 minutes | [`containers_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/containers_slides.md), [`containers_demo.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/containers_demo.md) |
13-
| 65 minutes | [`docker_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/docker_slides.md), [`docker_demo.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/docker_demo.md) |
14-
| 5 minutes | [`intro_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/intro_slides.md) |
15-
| 20 minutes | [`singularity_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/singularity_slides.md), [`singularity_demo.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/singularity_demo.md) |
16-
| 30 minutes | [`vagrant_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/vagrant_slides.md), [`vagrant_demo.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/vagrant_demo.md) |
17-
| 40 minutes | [`virtualbox_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualbox_slides.md), [`virtualbox_demo.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualbox_demo.md) |
18-
| 5 minutes | [`virtualmachines_slides.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualmachines_slides.md) |
19-
| 90 minutes | [`virtualmachines_containers_exercise.md`](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualmachines_containers_exercise.md) |
12+
| 5 minutes | [Virtualization and Containers](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/intro_slides.md) |
13+
| 15 minutes | [Virtualbox](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualbox_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/virtualbox_demo.md) |
14+
| 20 minutes | [Vagrant](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/vagrant_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/vagrant_demo.md) |
15+
| 30 minutes | [Docker](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/docker_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/docker_demo.md) |
16+
| 20 minutes | [Singularity / Apptainer](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/singularity_slides.md), [demo](https://github.com/Simulation-Software-Engineering/Lecture-Material/blob/main/02_virtualization_and_containers/singularity_demo.md) |

02_virtualization_and_containers/docker_demo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- We can make sure that the container is removed after exiting by the `--rm` options, i.e., `docker run --rm -i -t ubuntu /bin/bash`
2424

2525
- When container is running, we see it when calling `docker ps`
26-
- Start container (with name `tutoral`) `docker run --rm -i -t --name tutorial ubuntu /bin/bash`
26+
- Start container (with name `tutorial`) `docker run --rm -i -t --name tutorial ubuntu /bin/bash`
2727
- Leave it `CTRL-P-Q` (all keys pressed at the same time)
2828
- Show container running `docker ps`
2929
- Reattach to container `docker container attach tutorial`

02_virtualization_and_containers/docker_slides.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ Details available in [`docker_demo.md`](https://github.com/Simulation-Software-E
200200
- `FROM`: Defines base image
201201
- `RUN`: Defines commands to execute
202202
- `WORKDIR`: Defines working directory for following commands
203-
- `COPY`: Copy for from source to destination
204-
- `ADD`: Add for from source to destination (powerful and confusing)
203+
- `COPY`: Copy file from source to destination
204+
- `ADD`: Add file from source to destination (powerful and confusing)
205205
- `CMD`: Command to run under `docker run`
206206
- `ENV`: Sets environment variable
207207
- `ARG`: Environment variable for **only** the build process

02_virtualization_and_containers/virtualmachines_containers_exercise.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ This exercise consists of the following main steps:
8383
- 2 GB virtual disk
8484
- 1024 MB of memory
8585
- 32 MB of video memory
86+
- These specifications are for a server-only distribution. For a distribution with a Desktop environment (GUI), assign 4 GB of RAM and 8 GB of storage.
8687
3. Installing a Linux distribution on the virtual machine with
8788
- user called `USERNAME` (if your GitLab name is `@musterm`, then `musterm`)
8889
- (host)name of the machine `USERNAMEvm` (e.g., `mustermvm`)
@@ -96,6 +97,8 @@ In the following subsections you will find additional instructions and explanati
9697

9798
By default, [download Alpine Linux](https://alpinelinux.org/downloads/). [Ubuntu Server](https://ubuntu.com/download/server) is also fine.
9899

100+
**Note:** If you are operating on an **ARM 64-bit architecture**, use **Ubuntu 25.10 (Desktop version)** or a later version, instead.
101+
99102
#### 2. Creating the Virtual Machine
100103

101104
While the installation image is downloading, you can already prepare the virtual machine.
@@ -152,6 +155,7 @@ Let's install `fastfetch` from the community repositories, instead:
152155
- Enable the community repositories with `setup-apkrepos -c` and use the default settings
153156
- Update the cache with `apk update`
154157
- Install fastfetch with `apk add fastfetch`
158+
- Run fastfetch with `fastfetch`
155159
156160
Continue to step 5.
157161
@@ -163,6 +167,8 @@ Continue to step 5.
163167
- Install `neofetch` via `sudo apt update && sudo apt install -y neofetch`. This command will download and install `neofetch` using the package manager [`apt`](https://wiki.debian.org/Apt).
164168
- Clear the terminal using `clear` (or `Ctrl-L`) and run neofetch via by typing `neofetch` (or `fastfetch`) into the terminal and pressing `Enter`. It will show information about the Linux distribution version, available memory etc.
165169
170+
**Note:** If you are running **Ubuntu Desktop on an ARM 64-bit architecture**, you may encounter an error when trying to install `neofetch` (e.g., `E: Unable to locate package`). In this case, you can use `fastfetch` as an alternative, which can be installed via `apt`.
171+
166172
#### 5. Upload the Screenshot to SIM GitLab
167173
168174
- Take a screenshot via VirtualBox. At the top of the VirtualBox window you find the menu item `View`. There you find the option `Take Screenshot (Host+E)`. Save the screenshot as `screenshot-virtualbox-USERNAME.png`.
@@ -205,7 +211,7 @@ Fork and clone the repository mentioned above. The repository initially contains
205211
206212
- We want to start from scratch so initialize a new box using `vagrant init` inside this repository and add the resulting `Vagrantfile` to Git. Then adapt your `Vagrantfile` to incorporate the following settings:
207213
- Your virtual machine should be based on the [`bento/ubuntu-24.04` image](https://portal.cloud.hashicorp.com/vagrant/discover/bento/ubuntu-24.04). In case you need a different provider (e.g., `libvirt`), feel free to use another box, but state this in your submission.
208-
- The name of your VM should be `USERNAME-vm`.
214+
- The name of your VM should be `USERNAME-vm-vagrant`.
209215
- The VM must request [1024 MB of main memory](https://developer.hashicorp.com/vagrant/docs/providers/virtualbox/configuration).
210216
- We want a [new shared folder](https://developer.hashicorp.com/vagrant/docs/synced-folders/basic_usage) in our virtual machine. The directory where the `Vagrantfile` resides, i.e. `.`, should be mounted by default as `/mnt/shared/` in your virtual machine.
211217
- Run your box with `vagrant up` and make sure that everything works out as expected (`vagrant ssh`). If everything is fine, you can `exit` the VM. You do **not** have to stop/destroy the VM for the next step.

03_building_and_packaging/cmake_exercise.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ In this exercise, we need to fight. Not everything always works smoothly. This i
44

55
To get an independent and reproducible environment as common ground, we use and, thus repeat, Docker.
66

7-
Deadline: **Wednesday, November 27th, 2024, 9:00**
7+
Deadline: **Wednesday, November 26th, 2025, 9:00**
88

99
## Overview
1010

11-
- The goal of the exercise is to open a pull request from a fork of [the CMake exercise repository](https://github.com/Simulation-Software-Engineering/cmake-exercise-wt2425). Please name your pull request `Add building and container recipes` and assign yourself.
11+
- The goal of the exercise is to open a pull request from a fork of [the CMake exercise repository](https://github.com/Simulation-Software-Engineering/cmake-exercise). Please name your pull request `Add building and container recipes` and assign yourself.
1212
- Your pull request should add a `Dockerfile` and a `CMakeLists.txt`, besides some minor changes in `main.cpp`, such as commenting in some code parts.
1313
- From your pull request, it should be possible to create an executable container. After running the container, it should be possible to `cd` into `cmake-exercise` and then run the `build_and_run.sh` script.
1414
- Use as many of the currently commented-out additional files, which induce additional dependencies.

03_building_and_packaging/intro_slides.md

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -27,72 +27,73 @@ slideOptions:
2727

2828
---
2929

30-
## Learning goals of chapter
30+
## Learning Goals of Chapter
3131

3232
- Explain why software is packaged.
33-
- Create Python packages, publish on PyPI, and install with pip.
33+
- Create a distributable package of a Python code, publish on PyPI, and install with pip.
3434
- Understand the difference between static and dynamic libraries and common ways of installation on Linux.
3535
- Build C++ software and handle dependencies with Make and CMake.
3636
- Package C++ software with CPack and create Debian packages.
3737
- Create Spack packages, e.g., for high-performance computing systems with restricted access rights.
3838

3939
---
4040

41-
## What is packaging?
41+
## What is Packaging?
4242

4343
- Bare code is often hard to understand for everyone except the developer(s).
4444
- Packaging is a workflow to convert a code into a standardized distributable software.
45-
- A code can be standardized in various ways. Some examples are
46-
- creating a compact form by following a standardization.
47-
- providing an installation recipe, for example, using CMake / make.
48-
- bundling code into an app or software with some UI.
49-
- We discuss **creating a compact form by following a standardization**.
45+
- A code can be standardized in various ways. For example, by ...
46+
- ... providing an installation recipe, for example, using CMake / make.
47+
- ... bundling it into an app or software with a user interface.
48+
- ... packaging it according to an existing standard.
49+
- We discuss **packaging a code according to an existing standard**.
5050

5151
---
5252

53-
## Why should we package code? 1/2
53+
## Why Package Code? 1/2
5454

55-
- A bare code with many files typically has difficulties like
55+
- A code with many files typically has difficulties like
5656
- multiple dependencies and requirements of specific versions of dependencies.
5757
- intricate compilation / installation steps which are hard to get right.
5858
- missing or limited starting information / documentation, which means a high entry barrier.
5959

6060
---
6161

62-
## Why should we package code? 2/2
62+
## Why Package Code? 2/2
6363

6464
- Create a package to
65-
- benefit from a package index or package manager which is familiar for a broad audience.
65+
- benefit from a package index or package manager which is familiar to a broad audience.
6666
- benefit from automated handling of dependencies of package managers.
6767
- have ease of distribution and maintenance due to standardization.
6868
- increase overall usability and sustainability of your code.
6969

7070
---
7171

72-
## How to package code?
72+
## How to Package Code?
7373

7474
- First step is finding the right standard for your code.
7575
- There are several options:
76-
- One of the many Linux package managers: apt, dpkg, yum, RPM and many more ...
77-
- [CMake](https://cmake.org/) <span>: building / installation / packaging tool mostly for C, C++ projects<!-- .element: class="fragment" data-fragment-index="1" --></span>
78-
- [Spack](https://spack.io/) <span>: a package management tool mostly for supercomputing centers<!-- .element: class="fragment" data-fragment-index="1" --></span>
79-
- [Conan](https://conan.io/) <span>: open-source package manager for C and C++ development<!-- .element: class="fragment" data-fragment-index="1" --></span>
80-
- [PyPI](https://pypi.org/) and [pip](https://pypi.org/project/pip/)
76+
- Linux package managers: apt, dpkg, yum, RPM, etc.
77+
- [CMake](https://cmake.org/)
78+
- [Spack](https://spack.io/)
79+
- [Conan](https://conan.io/)
80+
- [pip](https://pypi.org/project/pip/)
8181
- [Conda](https://docs.conda.io/en/latest/)
82+
- and many more ...
8283

8384
---
8485

85-
## Why do we look at packaging a Python code?
86+
## Why Packaging a Python Code?
8687

8788
- Python is easy to understand and widely used in research software.
88-
- A well established packaging workflow already exists in the Python community.
89-
- Various examples of packaged codes already exist: [NumPy](https://pypi.org/project/numpy/), [SciPy](https://pypi.org/project/scipy/), [PyTorch](https://pypi.org/project/torch/) and more ...
89+
- Well established package managers and packaging tools already exist in the Python community.
90+
- Many famous examples: [NumPy](https://pypi.org/project/numpy/), [SciPy](https://pypi.org/project/scipy/), [PyTorch](https://pypi.org/project/torch/).
9091

9192
---
9293

93-
## Key takeaways
94+
## Key Takeaways
9495

9596
- Packaging or creating build recipe of a code is a standardized process.
9697
- Many options in packaging / building tools.
9798
- Most of these tools / methods are customized for use cases.
98-
- In this lecture we will concentrate on packaging of Python code.
99+
- In this lecture, we concentrate on packaging of Python code.

03_building_and_packaging/pip_demo.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,3 @@ pip show nutils
7373
```bash
7474
python -m pip install package-name
7575
```
76-
77-
## 4. How to read a PEP
78-
79-
- Have a look at [PEP 8](https://peps.python.org/pep-0008/)
80-
81-
## 5. Understanding a PyPI package webpage
82-
83-
- Having a look at [fenicsprecice](https://pypi.org/project/fenicsprecice/)

0 commit comments

Comments
 (0)