Skip to content

Commit 69f0b0c

Browse files
authored
Merge pull request #371 from carpentries-incubator/bielsnohr/june-2024-ukaea-updates
Updates and modifications from June 2024 run at UKAEA
2 parents f7a3b8d + ae65764 commit 69f0b0c

17 files changed

Lines changed: 237 additions & 123 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ vendor/
1717
.docker-vendor/
1818
Gemfile.lock
1919
tmp/
20-
.venv/
2120
venv/
2221
.venv/
2322
.*history
2423
.tool-versions
2524
.vscode/
2625
.ruby-version
26+
slides/*.ipynb
27+
slides/*.html

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55

66
## Intermediate Research Software Development Skills (Python)
77

8-
This is an intermediate-level course in collaborative research software engineering and development skills,
9-
using Python as an example language.
10-
It teaches these skills in a way that mimics a typical software development
11-
process working as a part of a team,
8+
This is an intermediate-level course in collaborative research software engineering and development skills,
9+
using Python as an example language.
10+
It teaches these skills in a way that mimics a typical software development
11+
process working as a part of a team,
1212
starting from an [existing piece of software](https://github.com/carpentries-incubator/python-intermediate-inflammation).
1313
The lesson is developed using [The Carpentries](https://carpentries.org) Jekyll lesson template.
1414

_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ extras_order:
100100
- object-oriented-programming
101101
- persistence
102102
- databases
103+
- vscode
103104
- quiz
104105
# Files and directories that are not to be copied.
105106
exclude:

_episodes/11-software-project.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ patients’ inflammation data and performs basic statistical analysis using Pyth
2020
---
2121

2222
## Patient Inflammation Study Project
23+
2324
You have joined a software development team that has been working on the
2425
[patient inflammation study project](https://github.com/carpentries-incubator/python-intermediate-inflammation)
2526
developed in Python and stored on GitHub.
@@ -98,17 +99,21 @@ and then obtain a local copy of that project (from your GitHub) on your machine.
9899
![View of your own fork of the software repository in GitHub](../fig/github-forked-repository-own.png){: .image-with-shadow width="900px" }
99100

100101
> ## Exercise: Obtain the Software Project Locally
102+
>
101103
> Using the command line, clone the copied repository
102104
> from your GitHub account into the home directory on your computer using SSH.
103105
> Which command(s) would you use to get a detailed list of contents of the directory you have just cloned?
104-
>
105-
>
106+
>
107+
>
106108
> > ## Solution
107109
> > 1. Find the SSH URL of the software project repository to clone from your GitHub account.
108110
> > Make sure you do not clone the original repository but rather your own fork,
109111
> > as you should be able to push commits to it later on.
110-
> > Also make sure you select the **SSH** tab and not the **HTTPS** one -
111-
> > for this course, SSH is the preferred way of authenticating when sending your changes back to GitHub.
112+
> > Also make sure you select the **SSH** tab and not the **HTTPS** one.
113+
> > For this course, SSH is the preferred way of authenticating when sending your changes back to GitHub.
114+
> > If you have only authenticated through HTTPS in the past,
115+
> > please follow the guidance [at the top of this section](#downloading-our-software-project)
116+
> > to add an SSH key to your GitHub account.
112117
> >
113118
> > ![URL to clone the repository in GitHub](../fig/clone-repository.png){: .image-with-shadow width="800px" }
114119
> >
@@ -269,6 +274,7 @@ are bigger modules that contain several smaller sub-modules.
269274
Another example of modules are classes in object-oriented programming languages.
270275
271276
> ## Programming Modules and Interfaces
277+
>
272278
> Although modules are self-contained and independent elements to a large extent
273279
> (they can depend on other modules),
274280
> there are well-defined ways of how they interact with one another.

_episodes/23-continuous-integration-automated-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ jobs:
201201
uses: actions/checkout@v4
202202
203203
- name: Set up Python 3.11
204-
uses: actions/setup-python@v4
204+
uses: actions/setup-python@v5
205205
with:
206206
python-version: "3.11"
207207
@@ -382,7 +382,7 @@ jobs:
382382
uses: actions/checkout@v4
383383
384384
- name: Set up Python
385-
uses: actions/setup-python@v4
385+
uses: actions/setup-python@v5
386386
with:
387387
# Here we add the reference to the python-version matrix values
388388
python-version: {% raw %}${{ matrix.python-version }}{% endraw %}

_extras/common-issues.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,28 @@ $ git config --global core.editor "nano -w"
137137
~~~
138138
{: .language-bash}
139139

140+
141+
## SSH key authentication issues with Git Bash
142+
143+
Git Bash uses its own SSH library by default, which may result in errors such as the one below
144+
even after adding your SSH key correctly:
145+
146+
~~~
147+
$ git clone git@github.com:https://github.com/ukaea-rse-training/python-intermediate-inflammation
148+
Cloning into 'python-intermediate-inflammation'...
149+
git@github.com: Permission denied (publickey).
150+
fatal: Could not read from remote repository.
151+
152+
Please make sure you have the correct access rights
153+
and the repository exists.
154+
~~~
155+
156+
The solution is to change the SSH library used by Git:
157+
158+
~~~
159+
$ git config --global core.sshCommand C:/windows/System32/OpenSSH/ssh.exe
160+
~~~
161+
140162
## Python, `pip`, `venv` & Installing Packages Issues
141163

142164
### Issues With Numpy (and Potentially Other Packages) on New M1 Macs

_extras/guide.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ title: "Instructor Notes"
99

1010

1111
## Course Design
12+
1213
The course follows a narrative around
1314
a software development team working on an existing software project
1415
that is analysing patients’ inflammation data
@@ -41,6 +42,7 @@ The course has been separated into 5 sections:
4142
Each section can be approximately delivered in a half-day but even better if you can allow 1 day per section.
4243

4344
## Course Delivery
45+
4446
The course is intended primarily for self-learning
4547
but other modes of delivery have been used successfully
4648
(e.g. fully instructor-led code-along mode or mixing in elements of instructor-led with self-work).
@@ -87,7 +89,16 @@ to make sure everyone is in sync as much as possible and are working on similar
8789
This synchronisation becomes particularly important for later workshop stages
8890
when students start with group exercises.
8991

92+
Although not explicitly endorsed,
93+
it is quite possible for learners to do the course using VS Code instead of PyCharm.
94+
There is a section for setting up VS Code in the [this adjacent extras page](../vscode).
95+
However, when progressing through the section [Integrated Software Development Environments](../13-ides),
96+
it can be a bit difficult for learners to pay attention to both pages.
97+
Therefore, some instructors have found it helpful to perform a demonstration on their own machines of how to use VS Code to achieve the same functionality as PyCharm.
98+
It is worthwhile preparing this in advance of the session.
99+
90100
### Helpers Roles and Responsibilities
101+
91102
At the workshop, when using the "self-learning with helpers" delivery mode, everyone in the training team is a helper and
92103
there are no instructors per se.
93104
You may have more experienced helpers delivering introductions to the workshop and sections.
@@ -110,8 +121,13 @@ Roles and responsibilities of helpers include:
110121
- Helping students get through the material
111122
but also being ready to answer questions on applying the material in learners’ domains,
112123
if possible
124+
- Monitoring the progress of students
125+
- get up every now and then and do a walk around the room, look at stickies and have a peak at
126+
computer screens (particularly if the session is running a bit behind)
127+
- ask any learners that you might have helped previously how they are getting on
113128

114129
### Group Exercises
130+
115131
Here is some advice on how best to sync and organise group exercises in later stages of the course.
116132

117133
- For earlier workshop stages,

_extras/vscode.md

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,32 @@ in the VS Code sidebar:
1818

1919
![VS Code application window with the Extensions button highlighted](../fig/vs-code-extensions.png){: .image-with-shadow width="800px" }
2020

21-
In the search box, type "python" and select the Intellisense Python extension by Microsoft,
22-
then click the "Install" button to install the extension. You may be asked to reload the VS Code IDE for the changes
23-
to take effect.
21+
In the search box, type "python" and select the Intellisense Python extension by Microsoft,
22+
then click the "Install" button to install the extension.
23+
You may be asked to reload the VS Code IDE for the changes to take effect.
2424

2525
![VS Code application with the list of extensions found by search term "python"](../fig/vs-code-python-extension.png){: .image-with-shadow width="800px" }
2626

27+
### Using VS Code with Windows Subsystem for Linux
28+
29+
If you are developing software on Windows,
30+
and particularly software that comes from or targets Unix or Linux systems,
31+
it can be advantageous to use [WSL (Windows Subsystem for Linux)][wsl].
32+
Although this course does not explicitly support WSL,
33+
we will provide some guidance here on how to best link up WSL with VS Code (if that is your use case).
34+
In your WSL terminal, navigate to the project folder for this course and execute the command:
35+
36+
```bash
37+
code .
38+
```
39+
40+
This should launch VS Code in a way that ensures it performs most operations within WSL.
41+
To do this, the [WSL - Remote extension][vscode-wsl-extension]
42+
for VS Code should automatically be installed.
43+
If this does not happen, please install the extension manually.
44+
You can also launch WSL sessions from VS Code itself using the
45+
[instructions on the extension page.][vscode-wsl-extension-launch-options]
46+
2747
## Using the VS Code IDE
2848

2949
Let us open our software project in VS Code and familiarise ourselves with some commonly used features needed for this course.
@@ -85,7 +105,7 @@ For this course you will need to install `pytest`, `numpy` and `matplotlib`. Sta
85105
following:
86106

87107
~~~
88-
pip install numpy matplotlib pytest
108+
python3 -m pip install numpy matplotlib pytest
89109
~~~
90110
{: .language-bash}
91111

@@ -98,7 +118,7 @@ Pip will usually inform you via a warning if a newer version is available.
98118
You can upgrade pip by running the following from the terminal:
99119

100120
~~~
101-
pip install --upgrade pip
121+
python3 -m pip install --upgrade pip
102122
~~~
103123
{: .language-bash}
104124

@@ -175,3 +195,8 @@ When clicking on a test you will see two icons,
175195
the ordinary Run/Play icon, and a Run/Play icon with a bug.
176196
The latter allows you to run the tests in debug mode
177197
useful for obtaining further information as to why a failure has occurred - this will be covered in the main lesson material.
198+
199+
200+
[vscode-wsl-extension]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl
201+
[vscode-wsl-extension-launch-options]: https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl#commands
202+
[wsl]: https://learn.microsoft.com/en-us/windows/wsl/about

fig/git-feature-branch.png

-52.9 KB
Binary file not shown.

slides/README.md

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,23 @@ python3 -m venv .venv # it is important to use the dot prefix if you are creati
1515
pip install -r slides/requirements.txt
1616
# launch jupyter from the top level of this repo, **not** in the slide
1717
# directory or else the relative figure links will not work
18-
jupyter-notebook
19-
# navigate to the slide file and edit
18+
jupyter-notebook # or `jupyter-lab`
19+
# navigate to the slide file, right click then select "open with > notebook".
2020
```
2121

22+
> Note: we have had mixed success using the RISE extension in both `jupyter-notebook` and `jupyter-lab`.
23+
> Try the other if one isn't working for you.
24+
> To use the old `jupyter-notebook`, put this in the `requirements.txt` file:
25+
>
26+
> ```requirements
27+
> notebook < 7.0.0
28+
> rise
29+
> jupytext
30+
> ```
31+
2232
Use the RISE extension to Jupyter to view the slides.
2333
This allows you to enter the slideshow from the Jupyter notebook web interface.
24-
There should be a button with a histogram on the Jupyter notebook toolbar
34+
There should be a "projector screen" button on the Jupyter notebook toolbar next to the kernel name
2535
(you might need to go to the 'View' menu to get the toolbar to show).
2636
Click the button, or press `Alt-r` to launch the RISE presentation view.
2737
Use spacebar to advance slides. Presenter view with `t`.

0 commit comments

Comments
 (0)