Collaborative code development#
In this assignment you’ll create a collaborative code base for some very basic mathematical functions. You will divide your group in three subteams. With each subteam you’ll work on implementations, but you will also review the other subteams’ code and extend their functions and documentation. During this process you’ll draw a Git history graph by hand, including the commit messages. You can use this graph during the offline question session. Remember that you can use VS Code Source Control graph to monitor the history of your repository, but please note that it might look slightly different depending on on which machine you are working.
You will work in a repository that is created from scratch (no starter files), use Jupyter notebooks for code, and write documentation in a README.md. This repository is not graded.
Task 1: Create a new empty repository on GitHub#
One team member creates a new empty repository in their personal GitHub account.
Name your repository (for example:
GA1.1-teamX).Add all team members as collaborators. (On the repository homepage -> Settings -> Collaborators)
Task 2: Create the initial project structure#
Clone the repository locally using VS Code.
In your local repository, one of you creates:
a folder
notebooks/a file
README.md
Commit and push this initial structure to
main.
Task 3: Create base functions on separate branches#
Now, you will work in 3 subteams, each with their own function to implement:
Subteam A:
add(a, b)Subteam B:
subtract(a, b)Subteam C:
multiply(a, b)
Instructions:
Create a branch for your task:
feature/<subteam>-base-function(replace all<and>too, your computer and git don’t like strange symbols)Create your notebook in
notebooks/:add.ipynborsubtract.ipynbormultiply.ipynb
In your notebook:
define your function
add 2–3 simple example calls
Before every commit: clear notebook outputs.
Update
README.mdwith a short subsection for your function. Describe what it does and when it might break. Add a short example of how to use it.Commit and push your branch.
Open a Pull Request to
mainon GitHub.Collectively as a team, start your hand-drawn Git history graph. Remember to include the commit messages.
Task 4: Review both other subteams’ Pull Requests#
Each subteam must review PRs from both other subteams.
For each review:
Pull the PR branch locally.
Run the notebook/function locally and test it with 2–3 example calls.
Write a review comment in the PR that includes:
what you tested
result of the test
some screenshot as evidence
Approve or request changes with a clear reason.
Task 5: Merge and resolve a README conflict#
You’ll now merge these PRs into main, which will highly likely create a merge conflict in README.md. You will resolve this conflict manually with the complete team.
Merge one PR first.
For the other PR(s), resolve the merge conflict manually in
README.md.Update your hand-drawn Git history graph including the merge commits.
Push the resolved branch and complete the PR merge.
Update your hand-drawn Git history graph including the merge commits.
Task 6: Extend your function#
Now implement an extension function to extend the codebase. Work on the work previously performed by another team:
Subteam B:
sum_list(values)and repeatedly calladd(...)Subteam C:
distance_from_zero(x)and callsubtract(...)Subteam A:
square(x)and callmultiply(...)
Rules:
Create a branch based on the updated
main:feature/<subteam>-extension-function. Make sure you’ve synced your localmainwith the remotemainbefore creating this branch.The new function must call the original base function.
Clear notebook outputs before commit.
Update
README.mdwith a short explanation and example.Open a PR to
main.
Task 7: Review and merge#
As before, review the other subteams’ PRs and merge them into main. Resolve any merge conflicts in README.md as a subteam. Update your hand-drawn Git history graph accordingly, remembering to include the commit messages.
If you’ve time left, you can continue with the bonus assignment.