Skip to content

Git and Gitlab - Beginners, working as a team

During this session, we will address collaborative work with Git and Gitlab. You will hence continue developing the smart todo list application, but this time as a group.

Several on Gitlab

Here, we will place ourselves in real conditions of collaborative work by deepening the concepts of Git. You will be divided according to your PRONTO project group.

  1. As a group, decide one of your Gitlab project to continue development
  2. The owner of the project, will search for and add the rest of the group to this project and give them the Maintainer status so they can contribute equally to it.
  3. Each added group member will now clone this shared repository
  4. When every member of the group has cloned the repository, go to the next section

All the necessary information on Gitlab to carry out these steps can be found here: Gitlab

Conflicts in Git

As we wish to simulate how beginner developers tend to work together, there is a set of instructions related to the work for the rest of the session:

  1. All work must be only commited and pushed on the main default branch
  2. All code developed must be added to the one python file main.py
  3. For each development task, focus on the minimal amount of code to complete the task (no restructuration of the code is to be made)

Now you can split the list of tasks between each other, and start development.

Tip

The git status command is very useful for providing information about the state of a repository and often offers solution hints.

Remember the basic Git workflow: add - commit - push

Does everything seem right?

Development Tasks

To continue developing the smart todo list application, the following set of tasks will need to be completed.

A common format for the todo is to be respected: [ ] todo text description | priority=low | due=none

Task 1 – Load Todos from File

Load todos from todos.txt if it exists. Start with an empty list if the file doesn’t exist.

Tip

Use open("todos.txt", "r")and readlines()

Use .strip() to remove newlines

Handle file-not-found with try / except

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)

Task 2 – Delete a Todo

Implement a delete command: remove a todo by number. Save changes to the file immediately.

Tip

Convert input to integer: int(input())

Remove todo with list.pop(index)

Save file with open("todos.txt","w")

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)

Task 3 – Toggle Done Status

Implement a done command to mark a todo [ ] or [x].

Tip

Use .startswith("[ ]") and .replace()

Access the correct todo using list[index]

Save file after modification

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)

Task 4 – Set Priority

Implement priority command to set low, medium, or high.

Tip

Store priority inside the todo string: | priority=low |

Use .split("|") to access string parts

Recombine parts after modifying priority

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)

Task 5 – Set Due Date

Implement a due command to set a due date: | due=YYYY-MM-DD.

Tip

Use .split('|') to access string parts

Modify the third part to include due date

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)

Task 6 – Redesign Display

Improve list output: add headers, numbering, separators.

Tip

Use print("----- TODOS -----")

Loop with for i in range(len(todos))

End with separator

➡ Push your modification on the main branch on gitlab (with git add, git commit, git push)