Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add local runner exercise #407

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions _episodes/00-setting-the-scene.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ software development in a typical collaborative code development cycle:
- **Command line** for running code and interacting with the **command line tool Git** for
- **Integrated Development Environment** for **code development, testing and debugging**,
**Version control** and using code branches to develop new features in parallel,
- **GitHub** (central and remote source code management platform supporting version control with Git)
- **GitLab** (central and remote source code management platform supporting version control with Git)
for **code backup, sharing and collaborative development**, and
- **Python code style guidelines** to make sure our code is
**documented, readable and consistently formatted**.
Expand All @@ -99,7 +99,7 @@ in this section we learn:

- how to set up a **test framework** and write tests to verify the behaviour of our code is correct, and
- how to automate and scale testing with **Continuous Integration (CI)** using
**GitHub Actions** (a CI service available on GitHub).
**[GitLab CI/CD](https://about.gitlab.com/topics/ci-cd/)** (a CI service available on GitLab).

### [Section 3: Software Development as a Process](../30-section3-intro/index.html)
In this section, we step away from writing code for a bit
Expand Down Expand Up @@ -138,7 +138,7 @@ Finally, we move beyond just software development to managing a collaborative so
- how to adopt a critical mindset not just towards our own software project
but also to **assess other people's software to ensure it is suitable** for us to reuse,
identify areas for improvement,
and how to use GitHub to register good quality issues with a particular code repository.
and how to use GitLab to register good quality issues with a particular code repository.

## Before We Start

Expand Down Expand Up @@ -174,7 +174,7 @@ A few notes before we start.

> ## Outdated Screenshots
> Throughout this lesson we will make use and show content
> from Graphical User Interface (GUI) tools (PyCharm and GitHub).
> from Graphical User Interface (GUI) tools (PyCharm and GitLab).
> These are evolving tools and platforms, always adding new features and new visual elements.
> Screenshots in the lesson may then become out-of-sync,
> refer to or show content that no longer exists or is different to what you see on your machine.
Expand Down
35 changes: 4 additions & 31 deletions _episodes/10-section1-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,33 +30,6 @@ As you get more comfortable with different tools and their alternatives,
you will select the one that is right for you based on your personal preferences
or based on what your collaborators are using.

{% comment %}
![Tools needed to collaborate on code development effectively](../fig/section1-overview.png){: .image-with-shadow width="800px" }
{% endcomment %}

![Tools needed to collaborate on code development effectively](../fig/section1-overview.svg){: .image-with-shadow width="1000px" }

{% comment %}
flowchart LR
A(1. Setting up
software environment

- Isolate and run code: command line, virtual environment & IDE
- Version control and share code: Git & GitHub
- Write well-written code: PEP8)
--> B(2. Verifying
software correctness)
--> C(3. Software development
as a process)
--> D(4. Collaborative
development for reuse)
--> E(5. Managing software
over its lifetime)

https://mermaid.live/edit#pako:eNpdkttKAzEQhl9lyIVsoS14AtkLQW3RggVRUJC9GXdn20A2s0wmLSK-u0m3K2IuQpj83z-H5MvU3JApTet4X29RFB6fKw9p3RSnc3ghVes3EHsYooFb3aMQkN9ZYd-R18oPdzNYBXaoBOgbkOghm5dp77occdbTFBKmEd1fgwAnsFosw2jzShIsZ9yrsDvYhW3OOhjeW01E2h_ix8i8iU2J9-TcbJ-OSmP2p-XT1aTys9k13BZn82xu28_U1L-GahahWj2FMIFBf1ecpxGMgoZ25LjPBR-HgQEQeuE6MwOyKC7mcMfO4QcLqt3RUfuXbllAKAY6Qsvicg5r9LjJs_6taAB5RwI2zcjZltR2NDFT05F0aJv0cF9ZVRndUkeVKdOxoRaj08pU_jtJMSq_fPralCqRpib2TXqihcWNYGfKFl1IUWqssqyHz3D4E6NyebgZ6R79O_PIff8AoRHADA

{% endcomment %}

Here is an overview of the tools we will be using.

> ## Setup, Common Issues & Fixes
Expand All @@ -70,7 +43,7 @@ Here is an overview of the tools we will be using.
We will use the [command line](https://en.wikipedia.org/wiki/Shell_(computing))
(also known as the command line shell/prompt/console)
to run our Python code
and interact with the version control tool Git and software sharing platform GitHub.
and interact with the version control tool Git and software sharing platform GitLab.
We will also use command line tools
[`venv`](https://docs.python.org/3/library/venv.html)
and [`pip`](https://pip.pypa.io/en/stable/)
Expand Down Expand Up @@ -98,13 +71,13 @@ and command line tools you may use in the future
We will use [PyCharm](https://www.jetbrains.com/pycharm/) in this course -
a free, open source IDE.

### Git & GitHub
### Git & GitLab
[Git](https://git-scm.com/) is a free and open source distributed version control system
designed to save every change made to a (software) project,
allowing others to collaborate and contribute.
In this course, we use Git to version control our code in conjunction with [GitHub](https://github.com/)
In this course, we use Git to version control our code in conjunction with [GitLab](https://gitlab.com/)
for code backup and sharing.
GitHub is one of the leading integrated products and social platforms
GitLab is one of the leading integrated products and social platforms
for modern software development, monitoring and management -
it will help us with
version control,
Expand Down
64 changes: 28 additions & 36 deletions _episodes/11-software-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ questions:
- "What is the design architecture of our example software project?"
- "Why is splitting code into smaller functional units (modules) good when designing software?"
objectives:
- "Use Git to obtain a working copy of our software project from GitHub."
- "Use Git to obtain a working copy of our software project from GitLab."
- "Inspect the structure and architecture of our software project."
- "Understand Model-View-Controller (MVC) architecture in software design and its use in our project."

Expand All @@ -22,8 +22,8 @@ patients’ inflammation data and performs basic statistical analysis using Pyth
## Patient Inflammation Study Project

You have joined a software development team that has been working on the
[patient inflammation study project](https://github.com/carpentries-incubator/python-intermediate-inflammation)
developed in Python and stored on GitHub.
[patient inflammation study project](https://ci.tno.nl/gitlab/scientific-software-engineering-course/2024-11-25/python-intermediate-inflammation)
developed in Python and stored on GitLab.
The project analyses the data to study the effect of a new treatment for arthritis
by analysing the inflammation levels in patients who have been given this treatment.
It reuses the inflammation datasets from the
Expand Down Expand Up @@ -55,67 +55,59 @@ to fix and build on top of the existing code during the course.
## Downloading Our Software Project

To start working on the project, you will first create a fork of the software project repository
from GitHub within your own GitHub account
and then obtain a local copy of that project (from your GitHub) on your machine.
from GitLab within the workshop's GitLab group
and then obtain a local copy of that project (from your GitLab) on your machine.

1. Make sure you have a GitHub account
and that you have [set up SSH key pair for authentication with GitHub](../setup.html#secure-access-to-github-using-git-from-command-line).
1. Make sure you have a GitLab account
and that you have [set up SSH key pair for authentication with GitLab](../setup.html#secure-access-to-gitlab-using-git-from-command-line).

***Note:** while it is possible to use HTTPS with a personal access token for authentication
with GitHub, the recommended and supported authentication method to use for this course
with GitLab, the recommended and supported authentication method to use for this course
is SSH with key pairs.*
2. Log into your GitHub account.
3. Go to the [software project repository](https://github.com/carpentries-incubator/python-intermediate-inflammation)
in GitHub.

![Software project fork repository in GitHub](../fig/github-fork-repository.png){: .image-with-shadow width="900px" }

2. Log into your GitLab account.
3. Go to the [software project repository](https://ci.tno.nl/gitlab/scientific-software-engineering-course/2024-11-25/python-intermediate-inflammation)
in GitLab.
4. Click the `Fork` button
towards the top right of the repository's GitHub page to **create a fork** of the repository
under your GitHub account.
Remember, you will need to be signed into GitHub for the `Fork` button to work.
towards the top right of the repository's GitLab page to **create your own fork** of the repository
under the workshop's GitLab group.
Remember, you will need to be signed into GitLab for the `Fork` button to work.

***Note:** each participant is creating their own fork of the project to work on.*

***Note 2:** we are creating a fork of the software project repository (instead of copying it
from its template) because we want to preserve the history of all commits (with template copying
you only get a snapshot of a repository at a given point in time).*
5. Make sure to select your personal account
and set the name of the project to `python-intermediate-inflammation`
5. Make sure to select the workshop GitLab group as the **namespace**
and set the project slug of the project to `python-intermediate-inflammation-{your name}`
(you can call it anything you like,
but it may be easier for future group exercises if everyone uses the same name).
Ensure that you **uncheck** the `Copy the main branch only` option.
Ensure that you **uncheck** the `Only the default branch main` option.
This guarantees you get all the branches from this repository needed for later exercises.

![Making a fork of the software project repository in GitHub](../fig/github-fork-repository-confirm.png){: .image-with-shadow width="600px" }

6. Click the `Create fork` button
and wait for GitHub to create the forked copy of the repository under your account.
7. Locate the forked repository under your own GitHub account.
GitHub should redirect you there automatically after creating the fork.
6. Click the `Fork project` button
and wait for GitLab to create the forked copy of the repository under your account.
7. Locate the forked repository under the workshop's GitLab group.
GitLab should redirect you there automatically after creating the fork.
If this does not happen, click your user icon in the top right corner and select
`Your Repositories` from the drop-down menu, then locate your newly created fork.

![View of your own fork of the software repository in GitHub](../fig/github-forked-repository-own.png){: .image-with-shadow width="900px" }

> ## Exercise: Obtain the Software Project Locally
>
> Using the command line, clone the copied repository
> from your GitHub account into the home directory on your computer using SSH.
> from GitLab into the home directory on your computer using SSH.
> Make sure you do not clone the original repository but rather your own fork
> Which command(s) would you use to get a detailed list of contents of the directory you have just cloned?
>
>
> > ## Solution
> > 1. Find the SSH URL of the software project repository to clone from your GitHub account.
> > 1. Find the SSH URL of the software project repository to clone from GitLab.
> > Make sure you do not clone the original repository but rather your own fork,
> > as you should be able to push commits to it later on.
> > Also make sure you select the **SSH** tab and not the **HTTPS** one.
> > For this course, SSH is the preferred way of authenticating when sending your changes back to GitHub.
> > For this course, SSH is the preferred way of authenticating when sending your changes back to GitLab.
> > If you have only authenticated through HTTPS in the past,
> > please follow the guidance [at the top of this section](#downloading-our-software-project)
> > to add an SSH key to your GitHub account.
> > to add an SSH key to your GitLab account.
> >
> > ![URL to clone the repository in GitHub](../fig/clone-repository.png){: .image-with-shadow width="800px" }
> >
> > 2. Make sure you are located in your home directory in the command line with:
> > ~~~
Expand All @@ -124,7 +116,7 @@ and then obtain a local copy of that project (from your GitHub) on your machine.
> > {: .language-bash}
> > 3. From your home directory in the command line, do:
> > ~~~
> > $ git clone git@github.com:<YOUR_GITHUB_USERNAME>/python-intermediate-inflammation.git
> > $ git clone git@gitlab.com:<WORKSHOP_GROUP_NAME>/python-intermediate-inflammation-<YOUR NAME>.git
> > ~~~
> > {: .language-bash}
> > Make sure you are cloning your fork of the software project and not the original repository.
Expand All @@ -137,7 +129,7 @@ and then obtain a local copy of that project (from your GitHub) on your machine.
> > Note: If you have accidentally copied the **HTTPS** URL of your repository instead of the SSH one,
> > you can easily fix that from your project folder in the command line with:
> > ~~~
> > $ git remote set-url origin git@github.com:<YOUR_GITHUB_USERNAME>/python-intermediate-inflammation.git
> > $ git remote set-url origin git@gitlab.com:<WORKSHOP_GROUP_NAME>/python-intermediate-inflammation-<YOUR NAME>.git
> > ~~~
> > {: .language-bash}
> {: .solution}
Expand Down
4 changes: 2 additions & 2 deletions _episodes/12-virtual-environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ the `requirements.txt` file."
---

## Introduction
So far we have cloned our software project from GitHub and inspected its contents and architecture a bit.
So far we have cloned our software project from GitLab and inspected its contents and architecture a bit.
We now want to run our code to see what it does -
let us do that from the command line.
For the most part of the course we will run our code
Expand Down Expand Up @@ -525,7 +525,7 @@ from your virtual environment)
is update the contents of the `requirements.txt` file accordingly
by re-issuing `pip freeze` command
and propagate the updated `requirements.txt` file to your collaborators
via your code sharing platform (e.g. GitHub).
via your code sharing platform (e.g. GitLab).

> ## Official Documentation
> For a full list of options and commands,
Expand Down
2 changes: 1 addition & 1 deletion _episodes/13-ides.md
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ for now, the good thing is that we managed to set up our project for development
both from the command line and PyCharm and are getting the same outputs.
Before we move on to fixing errors and writing more code,
Let us have a look at the last set of tools for collaborative code development
which we will be using in this course - Git and GitHub.
which we will be using in this course - Git and GitLab.


## Optional exercises
Expand Down
Loading
Loading