Skip to content

Commit f7a7524

Browse files
committed
differences for PR #5
1 parent 5f047db commit f7a7524

9 files changed

+88
-55
lines changed

12-running-vscode.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ There are many other features and ways to access them, and we'll cover key ones
5858

5959
Extensions are a major strength of VSCode. Whilst VSCode appears quite lightweight, and presents a simple interface (particularly compared to many other IDEs!), this is quite deceptive.
6060
You can extend its functionality in many different ways.
61-
For example, installing support for other languages, greater support for version control, there's even support for working with databases, and so on.
61+
or example, installing support for other languages, greater support for version control, there's even support for working with databases, and so on.
6262
There are literally tens of thousands of possible extensions now.
6363

6464
Now VSCode already comes with built-in support for JavaScript, including TypeScript and node.js,
@@ -67,24 +67,24 @@ Installing a language extension will allow you to do more things with that parti
6767

6868
Let's install an extension now:
6969

70-
1. Firstly, select the extensions icon, then type in "Python" into the search box at the top, and it'll give you a list of all Python-related extensions.
70+
1. Firstly, select the extensions icon first, then type in Python into the search box at the top, and it'll give you a list of all python-related extensions.
7171
1. Select the one which says `Python` from Microsoft. This is the Microsoft official Python extension.
7272
1. Then select `Install`.
7373

7474
It might take a minute - you can see a sliding blue line in the top left to indicate it's working.
7575
Once complete, you should see a couple of "Welcome" windows introducing you to two of its key features - support for Python and Jupyter notebooks.
7676
If you use Jupyter notebooks, which is a way of writing Python programs that you can run line by line from within an editor as you write the program, you may find this useful.
7777

78-
For now, let's configure this extension for our Python development, and to do that, we need to tell VSCode which Python installation on our machine we'd like it to use. In the Python Welcome window, select `Select a Python interpreter`, and then `Select Python interpreter`.
79-
You may find you have many installations of Python, or only have one. Try to select the version later than 3.8 if you can.
80-
Then select `Mark done`, and close the Welcome window.
78+
For now, let's configure this extension for our Python development, and to do that, we need to do is tell VSCode which Python installation on our machine we'd like it to use. In the Python Welcome window, select `Select a Python interpreter`, and then `Select Python interpreter`.
79+
You may find you have many installations of Python, or only have one. Try to select one later than 3.8 if you can.
80+
Then select `Mark done`, and close the welcome windows.
8181

8282
## A Sample Project
8383

8484
FIXME: copy code-style-example repo to softwaresaved's organisation
8585

8686
Next, let's obtain some example Python and edit it from within VSCode.
87-
First, download the example code we'll use from https://github.com/UNIVERSE-HPC/code-style-example/releases/tag/v1.0.0, either as a `.zip` or `.tar.gz` compressed archive file.
87+
So first, you can download the example code we'll use from https://github.com/UNIVERSE-HPC/code-style-example/releases/tag/v1.0.0, either as a `.zip` or `.tar.gz` compressed archive file.
8888
If you're unsure, download the `.zip` file.
8989
Then, extract all the files from the archive into a convenient location.
9090
You should see files contained within a new directory named `code-style-example-1.0.0`.
@@ -103,9 +103,9 @@ Note that we're looking for the *folder* that contains the files, not a specific
103103

104104
If your system has the Git version control system installed, you may see a `Clone Repository` option here too.
105105
If you are familiar with Git and wish to use this option instead,
106-
select it and enter the repository's location as `https://github.com/UNIVERSE-HPC/code-style-example`.
106+
select this option instead and enter the repository's location as `https://github.com/UNIVERSE-HPC/code-style-example`.
107107
Then use the file browser that is presented to find a convenient location to store the cloned code and click on `Select as Repository Destination`,
108-
then select `Open` when ‘Would you like to open the cloned repository?' popup appears.
108+
then select `Open` when ‘Would you like to open the cloned repository?' appears.
109109

110110
:::::::::::::::::::::::::::::::::::::::::
111111

@@ -126,7 +126,7 @@ So next, let's look at editing code.
126126

127127
::::::::::::::::::::::::::::::::::::: keypoints
128128

129-
- Key VSCode features are accessible via the left navigation bar and the menu
129+
- Key VSCode features are accessible via the left navigation bar and the menu.
130130
- VSCode's capabilities can be increased by installing extensions
131131
- Language-specific support is available via extensions
132132
- A VSCode "workspace" is a project that consists of a collection of folder and files

13-code-editor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ But in essence, the code is designed to do the following:
4141
1. Open a file in the CSV (comma separated value) format
4242
1. Go through the file line by line, and:
4343
- If the line begins with a `#` symbol, ignore it.
44-
- Otherwise, extract the fourth column (which contains temperature in Fahrenheit), convert it to Celsius and Kelvin, and output those readings.
44+
- Otherwise, extract the fourth column (which is in Fahrenheit), convert it to Celsius and Kelvin, and output those readings.
4545

4646
Let's take a look at some of what the code editor gives us.
4747

14-running-debugging.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ exercises: 0
2525

2626
## Running Python in VSCode
2727

28-
Now let's try running a Python script.
29-
First, make sure your Python code doesn't have any errors!
28+
Now let's try running a Python file.
29+
First, make sure your Python doesn't have any errors!
3030
Then, select the "Play"-looking icon at the top right of the code editor.
3131

3232
FIXME: screenshot snippet of the play icon?
@@ -147,9 +147,7 @@ FIXME: show screenshot snippet of debugging icons
147147
- The first one is continue, which allows the script to keep running until the next breakpoint.
148148
- The next one allows us to step over - or through - the script one statement at a time.
149149
- The next two allow us to choose to step into or out of a function call, which is interesting.
150-
151150
If we want to examine the inner workings of a function during this debug session, we can do that.
152-
153151
- The green cycle one is to restart the debug process.
154152
- The red cross stops debugging completely.
155153

@@ -161,7 +159,7 @@ If we step again, and then again, our program halts because it's run into the pr
161159

162160
This tells us something useful - that the problem occurs in the first iteration of the loop.
163161
So, this implies, the problem might be with the first line of data being processed,
164-
since the Python code is going through the data file line by line.
162+
since the Python is going through the data file line by line.
165163
If we re-run the debugger, we can go through this process again.
166164
And we can see something interesting when we get to the `if` statement.
167165
From the code, we know that the if statement is looking for an exclamation mark at the beginning of the line to indicate a comment.

22-example-code.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ exercises: 0
77
:::::::::::::::::::::::::::::::::::::: questions
88

99
- Why should I write readable code?
10-
- What is a "Code Smell"?
10+
- What is a "code smell"?
1111

1212
::::::::::::::::::::::::::::::::::::::::::::::::
1313

@@ -19,7 +19,7 @@ exercises: 0
1919

2020
::::::::::::::::::::::::::::::::::::::::::::::::
2121

22-
## Obtaining Some Example Code
22+
## Obtaining Example Code
2323

2424
FIXME: copy code-style-example into softwaresaved org
2525

@@ -104,15 +104,24 @@ the code is deliberately written to contain some issues!
104104

105105
## Why Write Readable Code?
106106

107-
QUESTION: who has seen or used code that looks like this? Yes/No?
108-
QUESTION: who has written code like this? Yes/No
107+
108+
:::::::::::::::::: discussion
109+
110+
### Readable Code
111+
112+
As a group, answer the following questions:
113+
114+
- Who has seen or used code that looks like this?
115+
- Who has written code like this?
116+
117+
::::::::::::::::::
109118

110119
No one writes great code that's readable, well formatted, and well designed all the time.
111120
Sometimes you often need to explore ideas with code to understand how the code should be designed,
112121
and this typically involves trying things out first.
113122
But... the key is that once you understand how to do something,
114123
it's a good idea to make sure it's readable and understandable by other people,
115-
which may includes a future version of yourself,
124+
which may include a future version of yourself,
116125
6 months into the future.
117126
So it's really helpful to end up with good clean code so yit's easier to understand.
118127

@@ -131,7 +140,7 @@ you can save yourself (and possibly others) a lot of time later!
131140

132141
::::::::::::::::::::::::::::::::::::::::: callout
133142

134-
## Does my Code Smell?
143+
### Does my Code Smell?
135144

136145
Developers sometimes talk about "code smells”.
137146
Code smells are cursory indications from looking at the source code that a piece of code may have some deeper issues.
@@ -148,7 +157,7 @@ Something to bear in mind when writing code!
148157

149158
Now despite the issues with the code, does it work?
150159
Let's find out.
151-
So in the shell, in the root directory of the repository:
160+
Within the shell, in the root directory of the repository, run the code as follows:
152161

153162
```bash
154163
python climate_analysis.py
@@ -168,7 +177,7 @@ Max temperature in Celsius 16.33888888888889 Kelvin 289.4888888888889
168177
```
169178

170179
And we can see that the code does indeed appear to work,
171-
with celsius and kelvin values being printed to the terminal.
180+
with Celsius and Kelvin values being printed to the terminal.
172181
But how can we improve its readability?
173182
We'll use a special tool, called a code linter,
174183
to help us identify these sorts of issues with the code.

23-analysing-code.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ exercises: 0
1414

1515
::::::::::::::::::::::::::::::::::::: objectives
1616

17-
- Use pylint to verify a program’s adherence to an established Python coding style convention
17+
- Use Pylint to verify a program’s adherence to an established Python coding style convention
1818
- Describe the benefits of a virtual environment
1919
- Create and use a virtual environment to manage Python dependencies separately for our example code
2020
- Install the Pylint static code analysis tool as a VSCode extension
@@ -26,14 +26,21 @@ exercises: 0
2626

2727
## Installing a Code Linter
2828

29-
The first thing we need to do is install pylint,
29+
The first thing we need to do is install Pylint,
3030
a very well established tool for statically analysing Python code.
3131

32-
Now fortunately, pylint can be installed as a Python package,
33-
and we're going to create what's known as a virtual environment to hold this installation of pylint.
32+
Now fortunately, Pylint can be installed as a Python package,
33+
and we're going to create what's known as a virtual environment to hold this installation of Pylint.
3434

35-
QUESTION: who has installed a Python package before, using the program pip? Yes/No
36-
QUESTION: who has created and used a Python virtual environment before? Yes/No
35+
36+
:::::::::::::::::::::::::::::::::::::::::::::::: discussion
37+
38+
### Installing Python Packages
39+
40+
Who has installed a Python package before, using the program `pip`?
41+
Who has created and used a Python virtual environment before?
42+
43+
::::::::::::::::::::::::::::::::::::::::::::::::
3744

3845
### Benefits of Virtual Environments
3946

@@ -64,7 +71,7 @@ Make sure you're in the root directory of the repository, then type
6471
python -m venv venv
6572
```
6673

67-
Here, we're using the built-on Python venv module - short for virtual environment - to create a virtual environment directory called `venv`.
74+
Here, we're using the built-on Python `venv` module - short for virtual environment - to create a virtual environment directory called "venv".
6875
We could have called the directory anything, but naming it `venv` (or `.venv`) is a common convention,
6976
as is creating it within the repository root directory.
7077
This makes sure the virtual environment is closely associated with this project, and not easily confused with another.
@@ -83,7 +90,15 @@ You should notice the prompt changes to reflect that the virtual environment is
8390
(venv) $
8491
```
8592

86-
QUESTION: who has successfully created and activated their virtual environment? Yes/No?
93+
94+
:::::::::::::::::::::::::::::::::::::::::::::::: discussion
95+
96+
### Setting up a Virtual Environment - Check In
97+
98+
Who has successfully created and activated their virtual environment?
99+
100+
::::::::::::::::::::::::::::::::::::::::::::::::
101+
87102

88103
Now it's created, let's take a look at what's in this virtual environment at this point.
89104

@@ -123,7 +138,7 @@ which can help our code in many ways:
123138

124139
:::::::::::::::::::::::::::::::::::::::::
125140

126-
So we can install pylint into our virtual environment:
141+
So we can install `pylint` library into our virtual environment as:
127142

128143
```bash
129144
pip install pylint
@@ -151,7 +166,7 @@ tomlkit 0.13.2
151166
typing_extensions 4.13.1
152167
```
153168

154-
So in addition to pylint,
169+
So in addition to Pylint,
155170
we see a number of other dependent packages installed that are required by it.
156171

157172
We can also *deactivate* our virtual environment:
@@ -160,7 +175,7 @@ We can also *deactivate* our virtual environment:
160175
deactivate
161176
```
162177

163-
You should see the `(venv)` prefix disappear,
178+
You should see the "(venv)" prefix disappear,
164179
indicating we have returned to our global Python environment.
165180
Let's reactivate it since we'll need it to use pylint.
166181

@@ -172,7 +187,7 @@ Let's reactivate it since we'll need it to use pylint.
172187

173188
## Analysing our Code using a Linter
174189

175-
Let's point pylint at our code and see what it reports:
190+
Let's point Pylint at our code and see what it reports:
176191

177192
```bash
178193
pylint climate_analysis.py

24-linter-advanced.md

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ exercises: 0
88

99
- What can I do to increase the detail of Pylint reports?
1010
- How can I reduce unwanted messages from Pylint?
11-
- How can I use static code analysis tools with VSCode?
11+
- How can I use static code analysis tools within VSCode?
1212

1313
::::::::::::::::::::::::::::::::::::::::::::::::
1414

@@ -58,7 +58,13 @@ Messages
5858
...
5959
```
6060

61-
QUESTION: for those doing activity, who's managed to run this command? YES/NO
61+
:::::::::::::::::: discussion
62+
63+
### Pylint Verbose Reporting - Checkin
64+
65+
For those doing activity, who's managed to run this command?
66+
67+
::::::::::::::::::
6268

6369
It gives you some overall statistics,
6470
plus comparisons with the last time you ran it,
@@ -72,7 +78,7 @@ on aspects such as:
7278

7379
Looking at raw metrics,
7480
we can see that it breaks down our program into how many lines are
75-
code lines, python docstrings, standalone comments, and empty lines.
81+
code lines, Python docstrings, standalone comments, and empty lines.
7682
This is very useful, since it gives us an idea of how well commented our code is.
7783
In this case - not very well commented at all!
7884
For normal comments, the usually accepted wisdom is to add them to explain *why* you are doing something, or perhaps to explain how necessarily complex code works,
@@ -81,7 +87,13 @@ since clearly written code should do that itself.
8187

8288
## Increasing our Pylint Score - Adding a Docstring
8389

84-
QUESTION: Who's familiar with Python docstrings? Yes/No
90+
:::::::::::::::::: discussion
91+
92+
### Docstrings - Checkin
93+
94+
Who's familiar with Python docstrings?
95+
96+
::::::::::::::::::
8597

8698
Docstrings are a special kind of comment for a function,
8799
that explain what the function does,
@@ -99,7 +111,7 @@ Let's add one to our code now, within the `fahr_to_celsius` function.
99111
"""
100112
```
101113

102-
Re-run pylint - can see we have one less docstring error, and a slightly higher score.
114+
Re-run `pylint` command - can see we have one less docstring error, and a slightly higher score.
103115

104116
If you'd like to know more about docstrings and commenting,
105117
there's an in-depth [RealPython tutorial](https://realpython.com/documenting-python-code/) on these and the different ways you can format them.
@@ -191,7 +203,7 @@ Every time you re-run it now, the `C0301` issue will not be present.
191203
## Using Pylint within VSCode
192204

193205
The good news is that if you're using the VSCode IDE,
194-
we can also (or alternatively) install a Python linter in VSCode to give us this code analysis functionality, by installing a pylint extension.
206+
we can also (or alternatively) install a Python linter in VSCode to give us this code analysis functionality, by installing the Pylint extension.
195207
Select the `Extensions` icon and this time search for `Pylint`, the one by Microsoft, and click `Install`.
196208

197209
Going back to our code you should now find lots of squiggly underlines of various colours.

32-example-code.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ For this lesson we'll need to create a new GitHub repository based on the conten
2929

3030
1. Once logged into GitHub in a web browser,
3131
go to https://github.com/UNIVERSE-HPC/git-example.
32-
1. Select 'Use this template', and then select 'Create a new repository' from the dropdown menu.
33-
1. On the next screen, ensure your personal GitHub account is selected in the `Owner` field, and fill in `Repository name` with `git-example`.
32+
1. Select `Use this template`, and then select `Create a new repository` from the dropdown menu.
33+
1. On the next screen, ensure your personal GitHub account is selected in the `Owner` field, and fill in `Repository name` with "git-example".
3434
1. Ensure the repository is set to `Public`.
3535
1. Select `Create repository`.
3636

@@ -157,17 +157,17 @@ so select `Assign yourself`.
157157

158158
:::: challenge
159159

160-
## Adding Work for Ourselves
160+
### Adding Work for Ourselves
161+
162+
Repeat the process of adding issues on your GitHub repository for the following two issues in this order:
161163

162-
Repeat this process for the other two issues in the following order:
163164
- "Add missing docstrings to function and module"
164165
- "Script fails with undefined function name error"
166+
165167
We'll refer back to these issues later!
166168

167169
::::
168170

169-
QUESTION: who's created the three issues? Yes/No
170-
171171

172172
::::::::::::::::::::::::::::::::::::: keypoints
173173

fig/.gitkeep

Lines changed: 0 additions & 1 deletion
This file was deleted.

md5sum.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,17 @@
66
"links.md" "3191a9ad7a8ab470710936b6f372a0b5" "site/built/links.md" "2025-04-17"
77
"episodes/10-introduction.md" "d4f56612792b2a6e597b090b963b8671" "site/built/10-introduction.md" "2025-05-01"
88
"episodes/11-setup.md" "f58103cf58d052e2519abda5624f76d6" "site/built/11-setup.md" "2025-04-30"
9-
"episodes/12-running-vscode.md" "77f1013e07165584de1a3fdb7f1b7d33" "site/built/12-running-vscode.md" "2025-05-26"
10-
"episodes/13-code-editor.md" "34760d539f13c0e30cb86a4fb1679462" "site/built/13-code-editor.md" "2025-05-26"
11-
"episodes/14-running-debugging.md" "18892baa6149fe814aa15269f655fbaf" "site/built/14-running-debugging.md" "2025-05-26"
9+
"episodes/12-running-vscode.md" "76540d245e3ae8ad97b05bf239ec9676" "site/built/12-running-vscode.md" "2025-05-26"
10+
"episodes/13-code-editor.md" "88fa96ec8f4ead06f55c62018764c9ba" "site/built/13-code-editor.md" "2025-05-26"
11+
"episodes/14-running-debugging.md" "f371f042deec6d37bdebb143ab851488" "site/built/14-running-debugging.md" "2025-05-26"
1212
"episodes/20-introduction.md" "ab522284cfcceb13671dfb1ca5670c97" "site/built/20-introduction.md" "2025-05-01"
1313
"episodes/21-setup.md" "eb31e0147eb4306d480fff570786023f" "site/built/21-setup.md" "2025-04-30"
14-
"episodes/22-example-code.md" "34472d5cba8ce3ddf8e6afce1fd5506d" "site/built/22-example-code.md" "2025-05-09"
15-
"episodes/23-analysing-code.md" "d05ba920924358618760f44e5d5b5c74" "site/built/23-analysing-code.md" "2025-05-09"
16-
"episodes/24-linter-advanced.md" "ef63638ff387168de870df2d8a25d6d0" "site/built/24-linter-advanced.md" "2025-05-09"
14+
"episodes/22-example-code.md" "09910aacaafe716233edbe19a7da3e37" "site/built/22-example-code.md" "2025-05-26"
15+
"episodes/23-analysing-code.md" "283d9e1519ee372ca86d43e96bc5e60e" "site/built/23-analysing-code.md" "2025-05-26"
16+
"episodes/24-linter-advanced.md" "295ca1bfc44cc0d8b155f16319583c67" "site/built/24-linter-advanced.md" "2025-05-26"
1717
"episodes/30-introduction.md" "d0b6f39605e519787bc76b9e082680b3" "site/built/30-introduction.md" "2025-05-01"
1818
"episodes/31-setup.md" "71a49142004b3e75f421f10184a8d925" "site/built/31-setup.md" "2025-04-30"
19-
"episodes/32-example-code.md" "c5ce6e451684b081af6b5e5cd8bd2ab8" "site/built/32-example-code.md" "2025-05-09"
19+
"episodes/32-example-code.md" "5a94c8e30a7eac8efce48258aa1927af" "site/built/32-example-code.md" "2025-05-26"
2020
"episodes/33-feature-branch.md" "c5edf4ded0b94c43d36b41e47aed5c14" "site/built/33-feature-branch.md" "2025-05-09"
2121
"episodes/34-pull-request.md" "48f40d1c9ecc133381a7c4b4a3342526" "site/built/34-pull-request.md" "2025-05-09"
2222
"episodes/35-merge-pr.md" "6cc4e647f554ec1b8e259d068ca85bd4" "site/built/35-merge-pr.md" "2025-05-09"

0 commit comments

Comments
 (0)