Skip to content

Commit

Permalink
address some feedback from oct-2023
Browse files Browse the repository at this point in the history
  • Loading branch information
alessandrofelder committed Jul 13, 2024
1 parent bb8ab01 commit e40b386
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 14 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/update-issue.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ on:
jobs:
create_issues:
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Create issues from markdown files
run: |
for file in .issues/*.md; do
cd .issues/
for file in $( ls | sort -n ); do
title=$(head -n 1 $file)
body=$(tail -n +2 $file)
echo "Creating issue with title: $title"
Expand Down
21 changes: 16 additions & 5 deletions .issues/exercise_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## Setup your playground

Please follow these instructions step-by-step before the course starts.
Please follow these instructions step-by-step.

### 1. Fork this repository
### Fork this repository

![Indicates where the Fork button is (top-right corner of the repository page)](https://i.imgur.com/HiBlmrj.png)

### 2. Clone your repository locally
### Clone your repository locally

In a `bash` terminal on your computer, run:
```bash
Expand All @@ -23,10 +23,21 @@ A folder named `rse-best-practices-playground` should be listed.

(If this does not work, you may have to set up a personal access token: Follow the instructions [in the GitHub documentation](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token) and get in touch with the course organisers if you encounter issues.)

### 3. React to this issue with :+1:
### Create a conda environment for your playground

In your command line, run

```{.bash}
conda create -n "software-good-practice-course" python=3.11
```
```{.bash}
conda activate software-good-practice-course
```

### React to this issue with :+1:
![Select and add a reaction to this comment](https://user-images.githubusercontent.com/963242/95435873-0bcb4480-094b-11eb-9d37-2fdefdcb8c6f.png)

The next exercises will be described in the issues of the original repository (the one you made your fork from).
### 4. (Optional) Have a look at the code
### (Optional) Have a look at the code

You may want to study the code in `times.py`. You can find it by navigating to `rse-best-practices-playground` > `rse_best_practices_playground` > `times.py`. Can you figure out what the code is meant to do?
11 changes: 8 additions & 3 deletions .issues/exercise_2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,25 @@ This exercise will show how to do write a docstring.

## Setup
We suggest using [numpydoc](https://numpydoc.readthedocs.io/en/latest/format.html), i.e. the Numpy style guide for docstrings.
Checkout a new branch named `add-docstring` using `git`.

```bash
git checkout -b add-docstring
```

## Write a docstring
The method `calculate_fastest_time` in `times.py` doesn't have a docstring. Based on your understanding of the method, write a docstring using Numpy formatting. Describe what the method does, what are the inputs and the outputs.

## Submit a Pull Request
Once you have completed or made progress on the exercise, commit your changes, push them to your fork and open a pull request and ask for a review.

Create a **pull request (PR)** from your branch to `rse-best-practices-course-2023/rse-best-practices-playground` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
Create a **pull request (PR)** from your branch to `UCL-bioimage-analysis/rse-best-practices-playground` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

Add a meaningful title to that PR and a link to this issue: `rse-best-practices-course-2023/rse-best-practices-playground#2`.
Add a meaningful title to that PR and a link to this issue: `UCL-bioimage-analysis/rse-best-practices-playground-2024#2`.

## [Optional 1] Review a Pull Request
If you already completed the above exercise, you can review a PR from another participant. You can find the submitted PRs in the [GitHub interface](
https://www.github.com/rse-best-practices-course-2023/rse-best-practices-playground/pulls).
https://www.github.com/UCL-bioimage-analysis/rse-best-practices-playground/pulls).

## [Optional 2] Write docstrings for other methods
If you have time, write docstrings for the other methods in `times.py` and submit a new PR.
12 changes: 9 additions & 3 deletions .issues/exercise_3.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Exercise 3
This exercise will look at write a test to check that it works as expected.
This exercise will look at write a test to check that our function works as expected.

## Setup
Install the playground as a developer (`".[dev]"`), in editable (`-e`) mode, by navigating into the `rse-best-practices-playground` folder and running
Expand All @@ -8,6 +8,12 @@ pip install -e ".[dev]"
```
In this way you will have installed `pytest` and other useful tools for development.

Checkout a new branch named `add-test` using `git`.

```bash
git checkout -b add-test
```

## Write a test
The next step consists of converting the __main__ part of the code into a unit test.
i. Create a new file called `test_times.py` in the same directory where `times.py` is.
Expand All @@ -27,9 +33,9 @@ Run `pytest` on that directory and see whether the test is picked up by `pytest`
## Submit a Pull Request
Once you have completed or made progress on the exercise, commit your changes, push them to your fork and open a pull request and ask for a review.

Create a **pull request (PR)** from your branch to `rse-best-practices-course-2023/rse-best-practices-playground` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
Create a **pull request (PR)** from your branch to `UCL-bioimage-analysis/rse-best-practices-playground-2024` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

Add a meaningful title to that PR and a link to this issue: `rse-best-practices-course-2023/rse-best-practices-playground#3`.
Add a meaningful title to that PR and a link to this issue: `UCL-bioimage-analysis/rse-best-practices-playground-2024#3`.

## [Optional 1] Write more tests for `calculate_fastest_time`
Do you see any other ways the method `calculate_fastest_time` could fail?
Expand Down
12 changes: 10 additions & 2 deletions .issues/exercise_4.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,29 @@ For this exercise, we will look at how to rewrite (refactor) existing code in di
According to what was presented in the slides, do you see ways to reduce duplication?
Focus on the method `print_fastest_time` in `times.py`.

## Setup

Checkout a new branch named `refactor` using `git`.

```bash
git checkout -b refactor
```

## Review your changes
Run your script. Does it still behave as expected?
**Do your tests still pass?**

## Submit a Pull Request
Once you have completed or made progress on the exercise, commit your changes, push them to your fork and open a pull request and ask for a review.

Create a **pull request (PR)** from your branch to `rse-best-practices-course-2023/rse-best-practices-playground` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).
Create a **pull request (PR)** from your branch to `UCL-bioimage-analysis/rse-best-practices-playground-2024` [using the GitHub web interface](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request).

Add a meaningful title to that PR and a link to this issue: `rse-best-practices-course-2023/rse-best-practices-playground#4`.


## [Optional 1] Review a Pull Request
If you already completed the above exercise, you can review a PR from another participant. You can find the submitted PRs in the [GitHub interface](
https://www.github.com/rse-best-practices-course-2023/rse-best-practices-playground/pulls).
https://www.github.com/UCL-bioimage-analysis/rse-best-practices-playground-2024/pulls).

## [Optional 2] Refactor other methods
If you have time, refactor the other methods in `times.py` and submit a new PR.

0 comments on commit e40b386

Please sign in to comment.