Skip to content

Commit ae65764

Browse files
authored
Merge branch 'gh-pages' into bielsnohr/june-2024-ukaea-updates
2 parents f88f3d3 + f7a3b8d commit ae65764

47 files changed

Lines changed: 655 additions & 477 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
> [!NOTE]
2+
> We are currently transitioning the lesson to the new Carpentries lesson format - please put your pull requests on hold and submit issues only.
3+
14
[![DOI](https://zenodo.org/badge/257930838.svg)](https://zenodo.org/badge/latestdoi/257930838)
25

36
## Intermediate Research Software Development Skills (Python)
@@ -53,7 +56,7 @@ label ![pilot](https://shields.io/badge/-pilot-31E930).
5356
We welcome all contributions to improve the lesson! Maintainers will do their best to help you if you have any
5457
questions, concerns, or experience any difficulties along the way.
5558

56-
We'd like to ask you to familiarise yourself with our [Contribution Guide](CONTRIBUTING.md) and have a look at
59+
We would like to ask you to familiarise yourself with our [Contribution Guide](CONTRIBUTING.md) and have a look at
5760
the [more detailed guidelines][lesson-example] on proper formatting, instructions on compiling and rendering the lesson locally, and
5861
making any changes and adding new content or episodes.
5962

_episodes/00-setting-the-scene.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ So, you have gained basic software development skills either by self-learning or
2525
e.g., a [novice Software Carpentry course][swc-lessons].
2626
You have been applying those skills for a while by writing code to help with your work
2727
and you feel comfortable developing code and troubleshooting problems.
28-
However, your software has now reached a point where there’s too much code to be kept in one script.
29-
Perhaps it's involving more researchers (developers) and users,
28+
However, your software has now reached a point where there is too much code to be kept in one script.
29+
Perhaps it is involving more researchers (developers) and users,
3030
and more collaborative development effort is needed to add new functionality
3131
while ensuring previous development efforts remain functional and maintainable.
3232

_episodes/10-section1-intro.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ and introducing the project that we will be working on throughout the course.
2020
In order to build working (research) software efficiently
2121
and to do it in collaboration with others rather than in isolation,
2222
you will have to get comfortable with using a number of different tools interchangeably
23-
as they’ll make your life a lot easier.
23+
as they will make your life a lot easier.
2424
There are many options when it comes to deciding
2525
which software development tools to use for your daily tasks -
2626
we will use a few of them in this course that we believe make a difference.
@@ -124,6 +124,6 @@ Therefore, one should be aware of these guidelines
124124
and adhere to whatever the project you are working on has specified.
125125
In Python, we will be looking at a convention called PEP8.
126126

127-
Let's get started with setting up our software development environment!
127+
Let us get started with setting up our software development environment!
128128

129129
{% include links.md %}

_episodes/11-software-project.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ A novice will often make up the structure of their code as they go along.
251251
However, for more advanced software development,
252252
we need to plan and design this structure - called a *software architecture* - beforehand.
253253
254-
Let's have a quick look into what a software architecture is
254+
Let us have a quick look into what a software architecture is
255255
and which architecture is used by our software project
256256
before we start adding more code to it.
257257

_episodes/12-virtual-environments.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ the `requirements.txt` file."
2525
## Introduction
2626
So far we have cloned our software project from GitHub and inspected its contents and architecture a bit.
2727
We now want to run our code to see what it does -
28-
let's do that from the command line.
28+
let us do that from the command line.
2929
For the most part of the course we will run our code
3030
and interact with Git from the command line.
3131
While we will develop and debug our code using the PyCharm IDE
@@ -236,7 +236,7 @@ This will create the target directory for the virtual environment
236236
> and avoid issues that could prove difficult to trace and debug.
237237
{: .callout}
238238
239-
For our project let's create a virtual environment called "venv".
239+
For our project let us create a virtual environment called "venv".
240240
First, ensure you are within the project root directory, then:
241241
242242
~~~
@@ -342,7 +342,7 @@ When you’re done working on your project, you can exit the environment with:
342342
~~~
343343
{: .language-bash}
344344
345-
If you've just done the `deactivate`,
345+
If you have just done the `deactivate`,
346346
ensure you reactivate the environment ready for the next part:
347347
348348
~~~
@@ -565,7 +565,13 @@ In the above command, we tell the command line two things:
565565
As we can see, the Python interpreter ran our script, which threw an error -
566566
`inflammation-analysis.py: error: the following arguments are required: infiles`.
567567
It looks like the script expects a list of input files to process,
568-
so this is expected behaviour since we don't supply any.
568+
so this is expected behaviour since we do not supply any.
569569
We will fix this error in a moment.
570570
571+
## Optional exercises
572+
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-try-out-different-virtual-environment-managers)
573+
to try out different virtual environment managers.
574+
Or, [this exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-customize-the-command-line)
575+
to customize the command line.
576+
571577
{% include links.md %}

_episodes/13-ides.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ and Microsoft's free [Visual Studio Code (VS Code)](https://code.visualstudio.co
8080

8181
## Using the PyCharm IDE
8282

83-
Let's open our project in PyCharm now and familiarise ourselves with some commonly used features.
83+
Let us open our project in PyCharm now and familiarise ourselves with some commonly used features.
8484

8585
### Opening a Software Project
86-
If you don't have PyCharm running yet, start it up now.
86+
If you do not have PyCharm running yet, start it up now.
8787
You can skip the initial configuration steps which just go through
8888
selecting a theme and other aspects.
8989
You should be presented with a dialog box that asks you what you want to do,
@@ -156,7 +156,7 @@ and PyCharm is clever enough to understand it.
156156
so we can also use this environment for other projects if we wish.
157157
6. Select `OK` in the `Add Python Interpreter` window.
158158
Back in the `Preferences` window, you should select "Python 3.11 (python-intermediate-inflammation)"
159-
or similar (that you've just added) from the `Project Interpreter` drop-down list.
159+
or similar (that you have just added) from the `Project Interpreter` drop-down list.
160160

161161
Note that a number of external libraries have magically appeared under the
162162
"Python 3.11 (python-intermediate-inflammation)" interpreter,
@@ -170,7 +170,7 @@ and has added these libraries effectively replicating our virtual environment in
170170
Also note that, although the names are not the same -
171171
this is one and the same virtual environment
172172
and changes done to it in PyCharm will propagate to the command line and vice versa.
173-
Let's see this in action through the following exercise.
173+
Let us see this in action through the following exercise.
174174

175175
> ## Exercise: Compare External Libraries in the Command Line and PyCharm
176176
> Can you recall two places where information about our project's dependencies
@@ -314,15 +314,15 @@ You can also verify this from the command line by
314314
listing the `venv/lib/python3.11/site-packages` subdirectory.
315315
Note, however, that `requirements.txt` is not updated -
316316
as we mentioned earlier this is something you have to do manually.
317-
Let's do this as an exercise.
317+
Let us do this as an exercise.
318318
319319
> ## Exercise: Update `requirements.txt` After Adding a New Dependency
320320
> Export the newly updated virtual environment into `requirements.txt` file.
321321
>
322322
>
323323
>> ## Solution
324-
>> Let's verify first that the newly installed library `pytest` is appearing in our virtual environment
325-
>> but not in `requirements.txt`. First, let's check the list of installed packages:
324+
>> Let us verify first that the newly installed library `pytest` is appearing in our virtual environment
325+
>> but not in `requirements.txt`. First, let us check the list of installed packages:
326326
>> ~~~
327327
>> (venv) $ python3 -m pip list
328328
>> ~~~
@@ -412,7 +412,7 @@ and use on top of virtual environments.
412412
(i.e. the virtual environment and interpreter you configured earlier in this episode)
413413
in the `Python interpreter` field.
414414
5. You can give this run configuration a name at the top of the window if you like -
415-
e.g. let's name it `inflammation analysis`.
415+
e.g. let us name it `inflammation analysis`.
416416
6. You can optionally configure run parameters and environment variables in the same window -
417417
we do not need this at the moment.
418418
7. Select `Apply` to confirm these settings.
@@ -438,15 +438,15 @@ and use on top of virtual environments.
438438
Now you know how to configure and manipulate your environment in both tools
439439
(command line and PyCharm),
440440
which is a useful parallel to be aware of.
441-
Let's have a look at some other features afforded to us by PyCharm.
441+
Let us have a look at some other features afforded to us by PyCharm.
442442
443443
### Syntax Highlighting
444444
The first thing you may notice is that code is displayed using different colours.
445445
Syntax highlighting is a feature that displays source code terms
446446
in different colours and fonts according to the syntax category the highlighted term belongs to.
447447
It also makes syntax errors visually distinct.
448448
Highlighting does not affect the meaning of the code itself -
449-
it's intended only for humans to make reading code and finding errors easier.
449+
it is intended only for humans to make reading code and finding errors easier.
450450
451451
![Syntax Highlighting Functionality in PyCharm](../fig/pycharm-syntax-highlighting.png){: .image-with-shadow width="1000px" }
452452
@@ -569,7 +569,12 @@ We will get back to this error shortly -
569569
for now, the good thing is that we managed to set up our project for development
570570
both from the command line and PyCharm and are getting the same outputs.
571571
Before we move on to fixing errors and writing more code,
572-
let's have a look at the last set of tools for collaborative code development
572+
Let us have a look at the last set of tools for collaborative code development
573573
which we will be using in this course - Git and GitHub.
574574
575+
576+
## Optional exercises
577+
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-try-out-different-integrated-development-environments)
578+
to try out different IDEs and code editors.
579+
575580
{% include links.md %}

_episodes/14-collaboration-using-git.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test it to make sure it works correctly and as expected,
3636
then record your changes using version control
3737
and share your work with others via a shared and centrally backed-up repository.
3838

39-
Firstly, let's remind ourselves how to work with Git from the command line.
39+
Firstly, let us remind ourselves how to work with Git from the command line.
4040

4141
## Git Refresher
4242
Git is a version control system for tracking changes in computer files
@@ -57,9 +57,8 @@ Git has several important characteristics:
5757
so even if you make a mistake you can revert to a point before it.
5858

5959
The diagram below shows a typical software development lifecycle with Git
60-
(starting from making changes locally) and the commonly used commands to interact
61-
with different parts of the Git infrastructure,
62-
such as:
60+
(in our case starting from making changes in a local branch that "tracks" a remote branch) and the commonly used commands to interact
61+
with different parts of the Git infrastructure, including:
6362
- **working directory** -
6463
a local directory (including any subdirectories) where your project files live
6564
and where you are currently working.
@@ -102,24 +101,23 @@ such as:
102101
Created with https://mermaid.live/edit#pako:eNqVkjFrwzAQhf-KuKmlKd01BAoZ2yUZumi5SmdbRPI58oliQv57JbuloSaFajqd3sd7x-kMlh2BhpFOmXpLO49twmh6Vc4bp6PvW7Xziaxwmh6324eDYFubz4lQq9aLQucW_fVTlb6wxaD2NPDoK77ILcfoZSF-Kyq1p8hCK2zIY7dAK8Ftr4bEdretVgPqOWBH9shZ_stFSi39EXFNfQ0WgrobO05ic4nM6Sd6uYXAH-TU-6Susz3NZvewgVJE9K7s8Fy9DUhHkQzoUjpqMAcxYPpLkWIWPky9BS0p0wby4FC-Vw66wTCWLrma-HX5F_P3uHwCS-vA3Q
103102
sequenceDiagram
104103
Working Directory->>+Staging Area: git add
105-
Staging Area->>+Local Repository: git commit
106-
Local Repository->>+Remote Repository: git push
107-
Remote Repository->>+Local Repository: git fetch
108-
Local Repository->>+Working Directory:git checkout
109-
Local Repository->>+Working Directory:git merge
110-
Remote Repository->>+Working Directory: git pull (shortcut for git fetch followed by git checkout/merge)
104+
Staging Area->>+Local Repository Branch: git commit
105+
Local Repository Branch->>+Remote Repository Branch: git push
106+
Remote Repository Branch->>+Local Repository Branch: git fetch
107+
Local Repository Branch->>+Working Directory:git merge
108+
Remote Repository Branch->>+Working Directory: git pull (shortcut for git fetch followed by git merge for a 'tracking branch')
111109
-->
112110
<!--
113111
SVG of the diagram can be downloaded from:
114-
[![](https://mermaid.ink/img/pako:eNqVUj1PwzAQ_SvWTSCK2D1UQuoISzuwZDnsi2PVzgXnLBRV_e_YiSoKUZHwdL57T-_dxwkMWwINI31k6g3tPLqEselVeW-cjr53aucTGeE0PW63DwdBV5PPiVAr50WhtQv-ulShL2wwqD0NPPpKX-CGY_SyMH4jKmtPkYVWtCGP3UJaAW5rtSSmuy31o5fZW0fmyFn-QYmUHP1hbDXESzshqLux4yQmF6Ocvg2XXwj8SVa9T-ra1tMsdg8bKEFEb8vmTlW7AekoUgO6hJZazEEaaPpzgWIWPky9AS0p0wbyYFEuiwbdYhhLlmx1_Lpcw3wU5y-9M7w9?type=png)](https://mermaid.live/edit#pako:eNqVUj1PwzAQ_SvWTSCK2D1UQuoISzuwZDnsi2PVzgXnLBRV_e_YiSoKUZHwdL57T-_dxwkMWwINI31k6g3tPLqEselVeW-cjr53aucTGeE0PW63DwdBV5PPiVAr50WhtQv-ulShL2wwqD0NPPpKX-CGY_SyMH4jKmtPkYVWtCGP3UJaAW5rtSSmuy31o5fZW0fmyFn-QYmUHP1hbDXESzshqLux4yQmF6Ocvg2XXwj8SVa9T-ra1tMsdg8bKEFEb8vmTlW7AekoUgO6hJZazEEaaPpzgWIWPky9AS0p0wbyYFEuiwbdYhhLlmx1_Lpcw3wU5y-9M7w9)
112+
https://mermaid.ink/svg/pako:eNqFksFuwyAMhl8FcemmdS_AodKm7rZe2sOkKRcXnAQNcEaMpqjquw-SZZtUReEE9vfbP5iL1GRQKtnjZ8KgcW-hieCrIPJ6o_hhQyP2NqJmisPjbvdwYmhK8CkiKNFYFmDMxP9PFfSVNDhxxI56W-TiOULQ7aTS5L3lSbgAlhpH9MS4VKRLfTuVWOJWfdTIul21cfMUqmg9xgbX-9-Kf8w7J-76liLrlI1Q_DOUT87RFxpxHsRvq5EBseEIeqx4Hnts7uVWZsCDNXmWl-Koktyix0qqvDVYQ3JcySpcMwqJ6TQELRXHhFuZOgM8j16qGlyfo2jKPQ7T_xi_yUy-jJlZ3UF4J5p112_HVM9r
115113
-->
116-
![Development lifecycle with Git, containing Git commands add, commit, push, fetch, checkout, merge and pull](../fig/git-lifecycle.svg){: .image-with-shadow width="600px"}
114+
![Development lifecycle with Git, containing Git commands add, commit, push, fetch, restore, merge and pull](../fig/git-lifecycle.svg){: .image-with-shadow width="600px"}
117115
<p style="text-align: center;">
118116
Software development lifecycle with Git
119117
</p>
120118

121119
## Checking-in Changes to Our Project
122-
Let's check-in the changes we have done to our project so far.
120+
Let us check-in the changes we have done to our project so far.
123121
The first thing to do upon navigating into our software project's directory root
124122
is to check the current status of our local working directory and repository.
125123

@@ -164,7 +162,7 @@ and stop notifying us about it.
164162
Edit your `.gitignore` file in PyCharm
165163
and add a line containing "venv/" and another one containing ".venv/".
166164
It does not matter much in this case where within the file you add these lines,
167-
so let's do it at the end.
165+
so let us do it at the end.
168166
Your `.gitignore` should look something like this:
169167

170168
~~~
@@ -258,7 +256,7 @@ $ git pull
258256
~~~
259257
{: .language-bash}
260258

261-
Now we've ensured our repository is synchronised with the remote one,
259+
Now we have ensured our repository is synchronised with the remote one,
262260
we can now push our changes:
263261

264262
~~~
@@ -326,11 +324,11 @@ $ git branch
326324
~~~
327325
{: .output}
328326
329-
At the moment, there's only one branch (`main`)
327+
At the moment, there is only one branch (`main`)
330328
and hence only one version of the code available.
331329
When you create a Git repository for the first time,
332330
by default you only get one version (i.e. branch) - `main`.
333-
Let's have a look at why having different branches might be useful.
331+
Let us have a look at why having different branches might be useful.
334332
335333
### Feature Branch Software Development Workflow
336334
While it is technically OK to commit your changes directly to `main` branch,
@@ -343,7 +341,7 @@ Each feature branch should have its own meaningful name -
343341
indicating its purpose (e.g. "issue23-fix").
344342
If we keep making changes and pushing them directly to `main` branch on GitHub,
345343
then anyone who downloads our software from there will get all of our work in progress -
346-
whether or not it's ready to use!
344+
whether or not it is ready to use!
347345
So, working on a separate branch for each feature you are adding is good for several reasons:
348346
349347
* it enables the main branch to remain stable
@@ -384,7 +382,7 @@ Whichever is the case for you, a good rule of thumb is -
384382
nothing that is broken should be in `main`.
385383
386384
### Creating Branches
387-
Let's create a `develop` branch to work on:
385+
Let us create a `develop` branch to work on:
388386
389387
~~~
390388
$ git branch develop
@@ -437,7 +435,7 @@ the commits will happen on the `develop` branch
437435
and will not affect the version of the code in `main`.
438436
We add and commit things to `develop` branch in the same way as we do to `main`.
439437
440-
Let's make a small modification to `inflammation/models.py` in PyCharm,
438+
Let us make a small modification to `inflammation/models.py` in PyCharm,
441439
and, say, change the spelling of "2d" to "2D" in docstrings for functions
442440
`daily_mean()`,
443441
`daily_max()` and
@@ -507,7 +505,7 @@ $ git push -u origin develop
507505
> We still prefer to explicitly state this information in commands.
508506
{: .callout}
509507
510-
Let's confirm that the new branch `develop` now exist remotely on GitHub too.
508+
Let us confirm that the new branch `develop` now exist remotely on GitHub too.
511509
From the `Code` tab in your repository in GitHub,
512510
click the branch dropdown menu (currently showing the default branch `main`).
513511
You should see your `develop` branch in the list too.
@@ -528,7 +526,7 @@ $ git push origin develop
528526
{: .language-bash}
529527
530528
> ## What is the Relationship Between Originating and New Branches?
531-
> It's natural to think that new branches have a parent/child relationship
529+
> it is natural to think that new branches have a parent/child relationship
532530
> with their originating branch,
533531
> but in actual Git terms, branches themselves do not have parents
534532
> but single commits do.

0 commit comments

Comments
 (0)