Skip to content

Commit

Permalink
🔀 Merge pull request #375 from esciencecenter-digital-skills/optional…
Browse files Browse the repository at this point in the history
…-exercises

Add optional exercises for section 1 and 2
  • Loading branch information
bielsnohr authored Oct 3, 2024
2 parents ebc2baf + 2c22a6a commit facc1ee
Show file tree
Hide file tree
Showing 7 changed files with 158 additions and 0 deletions.
6 changes: 6 additions & 0 deletions _episodes/12-virtual-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -568,4 +568,10 @@ It looks like the script expects a list of input files to process,
so this is expected behaviour since we don't supply any.
We will fix this error in a moment.
## Optional exercises
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-try-out-different-virtual-environment-managers)
to try out different virtual environment managers.
Or, [this exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-customize-the-command-line)
to customize the command line.
{% include links.md %}
5 changes: 5 additions & 0 deletions _episodes/13-ides.md
Original file line number Diff line number Diff line change
Expand Up @@ -572,4 +572,9 @@ Before we move on to fixing errors and writing more code,
let's have a look at the last set of tools for collaborative code development
which we will be using in this course - Git and GitHub.
## Optional exercises
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-try-out-different-integrated-development-environments)
to try out different IDEs and code editors.
{% include links.md %}
4 changes: 4 additions & 0 deletions _episodes/16-verifying-code-style-linters.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,8 @@ $ git push origin develop
> run it past Pylint to see what issues with your code are detected, if any.
{: .challenge}
## Optional exercises
Checkout [this optional exercise]({{ site.baseurl }}{% link _episodes/17-section1-optional-exercises.md %}#exercise-customize-pylint)
to learn more about `pylint`.
{% include links.md %}
89 changes: 89 additions & 0 deletions _episodes/17-section1-optional-exercises.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: "Optional Exercises for Section 1"
start: false
teaching: 0
exercises: 45
questions:
- "How can I further finetune my coding environment?"
objectives:
- "Explore different options for your coding environment."
keypoints:
---

This episode holds some optional exercises for section 1.
The exercises have an explorative nature, so feel free to go off in any direction that interests you.
You will be looking at some tools that either complement or are alternatives to those already introduced.
Even if you find something that you really like,
we still recommend sticking with the tools that were introduced prior to this episode when you move onto other sections of the course.

> ## Exercise: Apply to your own project(s)
> Apply what you learned in this section to your own project(s).
> This is the time to ask any questions to your instructors or helpers.
> Everyone has different preferences for tooling, so getting the input of experienced developers is a great opportunity.
>
{: .challenge}

> ## Exercise: Try out different Integrated Development Environments
> Install different Integrated Development Environments (IDEs) and test them out.
> Which one do you like the most and why?
>
> You can try:
> - [Visual Studio Code](https://code.visualstudio.com/), with setup instructions [in the Extras of this course]({{ site.baseurl }}{% link _extras/vscode.md %})
> - [Atom](https://atom-editor.cc/)
> - [Sublime Text](https://www.sublimetext.com/)
> - [RStudio](https://posit.co/download/rstudio-desktop/)
>
> Technically, compared to PyCharm, the 'IDEs' listed above are source code editors capable of functioning as an IDE
> (with RStudio as an example).
> To function as an IDE, you have to manually install plugins for more powerful features
> such as support for a specific programming language or unit testing.
> What do you prefer, a lot of tooling out of the box or a lightweight editor with optional extensions?
>
> If you want an even more lightweight setup you can try out these configurable source code editors:
> - [Emacs](https://www.gnu.org/software/emacs/)
> - [Vim](https://www.vim.org/)
>
{: .challenge}

> ## Exercise: Customize the command line
> You can customize the command line or use alternatives to `bash` to make yourself more productive.
> - Try out [z](https://github.com/rupa/z), a simple tool to more quickly move around directories.
> - Try out [Z shell (zsh)](https://zsh.sourceforge.io/), a shell designed for interactive use.
> - Try out [Oh My ZSH](https://ohmyz.sh/), which is a theming and package manager of the `zsh` terminal.
> - Try out [fish](https://fishshell.com/), a smart and user-friendly command line shell.
> - Try out [Bash Prompt Generator](https://bash-prompt-generator.org/), it lets you try out different prompts,
> depending on the information you want displayed.
>
{: .challenge}

> ## Exercise: Try out different virtual environment managers
> So far we used `venv`, but there are other virtual environment managers for Python:
> - [Poetry](https://python-poetry.org/).
> - conda, which is part of [Anaconda Distribution)](https://www.anaconda.com/download).
> Anaconda is widely used in academia, but the current license does not allow use for research in most circumstances.
> An open-source alternative is [mini-forge](https://github.com/conda-forge/miniforge).
>
{: .challenge}

> ## Exercise: Customize `pylint`
> You decide to change the max line length of your project to 100 instead of the default 80.
> Find out how you can configure pylint. You can first try to use the pylint command line interface,
> but also play with adding a configuration file that pylint reads in.
>
>> ## Solution
>> ### By passing an argument to `pylint` in the command line
>> Specify the max line length as an argument: `pylint --max-line-length=100`
>>
>> ### Using a configuration file
>> You can create a file `.pylintrc` in the root of your project folder to overwrite pylint settings:
>> ```
>> [FORMAT]
>> max-line-length=100
>> ```
> {: .solution}
{: .challenge}
{% include links.md %}
4 changes: 4 additions & 0 deletions _episodes/22-scaling-up-unit-testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,4 +350,8 @@ Using automated testing where appropriate can save us considerable time,
especially in the long term,
and allows others to verify against correct behaviour.
## Optional exercises
Checkout [these optional exercises]({{ site.baseurl }}{% link _episodes/25-section2-optional-exercises.md %}#exercise-customize-pylint)
to learn more about code coverage.
{% include links.md %}
49 changes: 49 additions & 0 deletions _episodes/25-section2-optional-exercises.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
title: "Optional exercises for section 2"
start: false
teaching: 0
exercises: 45
questions:
- "What is a desirable way to measure and use test coverage?"
objectives:
- "Further explore how to measure and use test coverage."
keypoints:
---

This episode holds some optional exercises for section 2.
The exercises have an explorative nature, so feel free to go off in any direction that interests you.
You will be looking at some tools that either complement or are alternatives to those already introduced.
Even if you find something that you really like,
we still recommend sticking with the tools that were introduced prior to this episode when you move onto other sections of the course.

> ## Exercise: Apply to your own project(s)
> Apply what you learned in this section to your own project(s).
> You can think of adding unit tests, add continuous integration pipelines,
> or measure the test coverage of your project(s)
> This is the time to ask any questions to your instructors or helpers.
>
{: .challenge}

> ## Exercise: Branch coverage versus line coverage
> For your test coverage, have a look at the concept of
> [branch coverage](https://about.codecov.io/blog/line-or-branch-coverage-which-type-is-right-for-you/)
> as opposed to just line coverage.
> Which do you prefer and why?
>
{: .challenge}

> ## Exercise: Desirable test coverage
> Look at the projects below and see how much test coverage they have.
> Should 100% line (or branch) coverage always be the goal? Why or why not?
> - [pytest](https://github.com/pytest-dev/pytest)
> - [pyjokes](https://github.com/pyjokes/pyjokes)
> - [scikit-learn](https://github.com/scikit-learn/scikit-learn)
>
{: .challenge}

> ## Exercise: Coverage badges
> Try to add a [coverage badge](https://github.com/marketplace/actions/coverage-badge) to the inflammation project.
>
{: .challenge}

{% include links.md %}
1 change: 1 addition & 0 deletions _extras/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ In addition, a short intro to the section topics is provided on each day,
to explain what the students will be learning and doing on that particular day.
After that, participants are split into groups
and go through the materials for that day on their own with helpers on hand.
Each section holds optional exercises at the end for fast learners to go through if they finish early.
At the end of each section, all reconvene for a joint Q&A session, feedback and wrap-up.
If participants have not finished all exercises for a section (in "self-learning with helpers" mode),
they are asked to finish them off before the next section starts
Expand Down

0 comments on commit facc1ee

Please sign in to comment.