Skip to content

Commit 52e7e7e

Browse files
authored
Merge pull request #385 from carpentries-incubator/nesc-optional-exercises
Add optional exercises for sections 1 and 2 coming from NeSC and @svenvanderburg
2 parents ebc2baf + ebe4ec9 commit 52e7e7e

7 files changed

Lines changed: 177 additions & 0 deletions

_episodes/12-virtual-environments.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,4 +568,10 @@ It looks like the script expects a list of input files to process,
568568
so this is expected behaviour since we don't 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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,4 +572,9 @@ Before we move on to fixing errors and writing more code,
572572
let's 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/16-verifying-code-style-linters.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,8 @@ $ git push origin develop
195195
> run it past Pylint to see what issues with your code are detected, if any.
196196
{: .challenge}
197197
198+
## Optional exercises
199+
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-customize-pylint)
200+
to learn more about `pylint`.
201+
198202
{% include links.md %}
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: "Optional Exercises for Section 1"
3+
start: false
4+
teaching: 0
5+
exercises: 45
6+
questions:
7+
- "How can I further finetune my coding environment?"
8+
objectives:
9+
- "Explore different options for your coding environment."
10+
keypoints:
11+
---
12+
13+
This episode holds some optional exercises for section 1.
14+
The exercises have an explorative nature, so feel free to go off in any direction that interests you.
15+
You will be looking at some tools that either complement or are alternatives to those already introduced.
16+
Even if you find something that you really like,
17+
we still recommend sticking with the tools that were introduced prior to this episode when you move onto other sections of the course.
18+
19+
> ## Exercise: Apply to your own project(s)
20+
>
21+
> Apply what you learned in this section to your own project(s).
22+
> This is the time to ask any questions to your instructors or helpers.
23+
> Everyone has different preferences for tooling, so getting the input of experienced developers is a great opportunity.
24+
>
25+
{: .challenge}
26+
27+
> ## Exercise: Try out different Integrated Development Environments
28+
>
29+
> Install different Integrated Development Environments (IDEs) and test them out.
30+
> Which one do you like the most and why?
31+
>
32+
> You can try:
33+
>
34+
> - [Visual Studio Code](https://code.visualstudio.com/), with setup instructions [in the Extras of this course]({{ site.baseurl }}{% link _extras/vscode.md %})
35+
> - [Atom](https://atom-editor.cc/)
36+
> - [Sublime Text](https://www.sublimetext.com/)
37+
> - [RStudio](https://posit.co/download/rstudio-desktop/)
38+
>
39+
> Technically, compared to PyCharm, the 'IDEs' listed above are source code editors capable of functioning as an IDE
40+
> (with RStudio as an example).
41+
> To function as an IDE, you have to manually install plugins for more powerful features
42+
> such as support for a specific programming language or unit testing.
43+
> What do you prefer, a lot of tooling out of the box or a lightweight editor with optional extensions?
44+
>
45+
> If you want an even more lightweight setup you can try out these configurable source code editors:
46+
>
47+
> - [Emacs](https://www.gnu.org/software/emacs/)
48+
> - [Vim](https://www.vim.org/)
49+
>
50+
{: .challenge}
51+
52+
> ## Exercise: Customize the command line
53+
>
54+
> You can customize the command line or use alternatives to `bash` to make yourself more productive.
55+
>
56+
> - Try out [Bash Prompt Generator](https://bash-prompt-generator.org/), it lets you try out different prompts,
57+
> depending on the information you want displayed.
58+
> - Try out [z](https://github.com/rupa/z), a simple tool to more quickly move around directories.
59+
> - Try out [Z shell (zsh)](https://zsh.sourceforge.io/), a shell designed for interactive use.
60+
> - Try out [Oh My ZSH](https://ohmyz.sh/), which is a theming and package manager of the `zsh` terminal.
61+
> - Try out [fish](https://fishshell.com/), a smart and user-friendly command line shell.
62+
>
63+
{: .challenge}
64+
65+
> ## Exercise: Try out different virtual environment managers
66+
>
67+
> So far we used `venv`, but there are other virtual environment managers for Python:
68+
>
69+
> - [Poetry](https://python-poetry.org/), which we will explore using in
70+
> [Section 4]({{ site.baseurl }}{% link _episodes/43-software-release.md %}).
71+
> - conda, which is part of [Anaconda Distribution)](https://www.anaconda.com/download).
72+
>
73+
> Anaconda is widely used in academia, but the current license does not allow use for research in most circumstances.
74+
> An open-source alternative is [mini-forge](https://github.com/conda-forge/miniforge).
75+
>
76+
{: .challenge}
77+
78+
> ## Exercise: Customize `pylint`
79+
>
80+
> You decide to change the max line length of your project to 100 instead of the default 80.
81+
> Find out how you can configure pylint. You can first try to use the pylint command line interface,
82+
> but also play with adding a configuration file that pylint reads in.
83+
>
84+
>> ## Solution
85+
>>
86+
>> ### By passing an argument to `pylint` in the command line
87+
>>
88+
>> Specify the max line length as an argument: `pylint --max-line-length=100`
89+
>>
90+
>> ### Using a configuration file
91+
>>
92+
>> You can create a file `.pylintrc` in the root of your project folder to overwrite pylint settings:
93+
>>
94+
>> ```
95+
>> [FORMAT]
96+
>> max-line-length=100
97+
>> ```
98+
> {: .solution}
99+
{: .challenge}
100+
101+
{% include links.md %}

_episodes/22-scaling-up-unit-testing.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,4 +350,10 @@ Using automated testing where appropriate can save us considerable time,
350350
especially in the long term,
351351
and allows others to verify against correct behaviour.
352352
353+
## Optional exercises
354+
355+
Checkout
356+
[these optional exercises]({{ site.baseurl }}{% link _episodes/25-section2-optional-exercises.md %})
357+
to learn more about code coverage.
358+
353359
{% include links.md %}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
title: "Optional Exercises for Section 2"
3+
start: false
4+
teaching: 0
5+
exercises: 45
6+
questions:
7+
- "What is a desirable way to measure and use test coverage?"
8+
objectives:
9+
- "Further explore how to measure and use test coverage."
10+
keypoints:
11+
---
12+
13+
This episode holds some optional exercises for section 2.
14+
The exercises have an explorative nature, so feel free to go off in any direction that interests you.
15+
You will be looking at some tools that either complement or are alternatives to those already introduced.
16+
Even if you find something that you really like,
17+
we still recommend sticking with the tools that were introduced prior to this episode when you move onto other sections of the course.
18+
19+
> ## Exercise: Apply to your own project(s)
20+
>
21+
> Apply what you learned in this section to your own project(s).
22+
> You can think of adding unit tests, add continuous integration pipelines,
23+
> or measure the test coverage of your project(s)
24+
> This is the time to ask any questions to your instructors or helpers.
25+
>
26+
{: .challenge}
27+
28+
> ## Exercise: Branch coverage versus line coverage
29+
>
30+
> For your test coverage, have a look at the concept of
31+
> [branch coverage](https://about.codecov.io/blog/line-or-branch-coverage-which-type-is-right-for-you/)
32+
> as opposed to just line coverage.
33+
> Which do you prefer and why?
34+
>
35+
{: .challenge}
36+
37+
> ## Exercise: Desirable test coverage
38+
>
39+
> Look at the projects below and see how much test coverage they have.
40+
> Should 100% line (or branch) coverage always be the goal? Why or why not?
41+
>
42+
> - [pytest](https://github.com/pytest-dev/pytest)
43+
> - [pyjokes](https://github.com/pyjokes/pyjokes)
44+
> - [scikit-learn](https://github.com/scikit-learn/scikit-learn)
45+
>
46+
{: .challenge}
47+
48+
> ## Exercise: Coverage badges
49+
>
50+
> Try to add a [coverage badge](https://github.com/marketplace/actions/coverage-badge) to the inflammation project.
51+
>
52+
{: .challenge}
53+
54+
{% include links.md %}

_extras/guide.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ In addition, a short intro to the section topics is provided on each day,
7878
to explain what the students will be learning and doing on that particular day.
7979
After that, participants are split into groups
8080
and go through the materials for that day on their own with helpers on hand.
81+
Each section holds optional exercises at the end for fast learners to go through if they finish early.
8182
At the end of each section, all reconvene for a joint Q&A session, feedback and wrap-up.
8283
If participants have not finished all exercises for a section (in "self-learning with helpers" mode),
8384
they are asked to finish them off before the next section starts

0 commit comments

Comments
 (0)