DEV Community

Hyunjin Shin (Jin)
Hyunjin Shin (Jin)

Posted on • Edited on

OSD600 - Lab 04

Link

Link to my repo
Link to Henrique Sagara's repo
Links to the issues that I opened in Sagara's Repo.
issue9, issue10, issue12, issue14, issue15

Links to the PR that I made to solve the issues
PR to solve issue 11, PR to solve issue 12, PR to solve issue 9

Link to Merge PR onto my repo
Link to Merge Commit onto my repo

Description

In this lab, the students are required to add a new feature to other class mate's repo. The tool now should support reading a config file named .config-file-name.toml located in home dir of the user.

For this lab, I worked on Henrique Sagara's repo, and he worked on my repo.

Process of working on Sagara's repo.

  • I first forked his repo, and then cloned it onto my local machine.
git clone https://github.com/gitdevjin/readme_genie.git
Enter fullscreen mode Exit fullscreen mode
  • Then, I made a new branch to test and add new features. I started reading through his code and the file structures of the repo. I found somethings that I thought I could improve. First, his project didn't include the .gitignore file so when I cloned his repo, __pycache__ folder was included. So I made antoher branch to solve this and made an issue for it, and then added .gitignore file, then committed, and opened a pull request. Second, he imported modules; however, there was no file that contains information about the imported modules, so I had to manually download the modules. I thought that this could be improved by making a file requirements.txt so that users can easily install dependencies. I made an issue for this, and I made another branch for this. I added requirements.txt file and comitted. For his convenience, I merged this branch with the previous branch(for .gitignore) for fast-forward merge and committed this branch. I made a pull request. Those two issues are now solved.
  • After I installed all the dependencies, and then I tried to run the tool. However, there was some errors and I couldn't run it. I googled it and used ChatGPT to figure out what the problem was. The problem was that one of his dependencies was not compatible with Python 3.12.0 or newer version. I made another issue for this, and I contacted him in Slack asking to check the problem. He asked me to make an virtual envrionment, and run the tool with it. I tried it but it didn't work. He made his tool as docker image and able to work on container.
  • I added a file that loads .readme_genie-config.toml file and changed code to apply the read configurations. However, there was a huge problem. Since it was running on docker container, it couldn't read the file in my local home directory. For example
os.path.expanduser("~/.codemage-config.toml")
Enter fullscreen mode Exit fullscreen mode

This couldn't read the file.

  • Therefore, I mounted the configuration file when I ran the docker image as the following command, and it worked
docker run --rm -v ~/.readme_genie-config.toml:/root/.readme_genie-config.toml readmegenie:latest python3 /app/readme_genie.py ./examples/javascript/server.js
Enter fullscreen mode Exit fullscreen mode
  • However, there are still some problems to solve. Since it's running on docker container, the output file will be saved inside the docker container.

Process of reviewing Sagara's Pull Request.

  • First, I added his original repo in the git remote.
git remote add sagara https://github.com/HTSagara/readme_genie.git
Enter fullscreen mode Exit fullscreen mode
  • Second, I fetched all the branches of his repo.
git fetch sagara
Enter fullscreen mode Exit fullscreen mode
  • Third, I made a branch on my local repo with his branch for the ongoing issue.
git checkout -b sagara sagara/issue12
Enter fullscreen mode Exit fullscreen mode
  • Fourth, I checked and tested the changed code using the following command.
git diff main
Enter fullscreen mode Exit fullscreen mode
  • Fifth, I first misunderstood the instruction of this lab, so I made the config file .code-mage-config.toml in my root directory of the project. I asked him to change the file path, but he let me realize that it should be home dir. So I just asked him to change the required config file name from .code-mage-config.toml to .codemage-config.toml since when there are too many dahses, it could be confusing. He thankfully and kindly changed the pull request(made a new commit).
  • Sixth, After he made a new commit to the branch that opened the pull request, I merged it.

Reflection

This lab was really tough. Writing the code for Adding the new feature wasn't that difficult. However, before I started coding for the new feature, there were a number of issues to fix and improve. There was no .gitignore file and there was no requirements.txt file. So I had to fix those things first. Then, I tried to use the tool, but it didn't work on my machine. To fix the problem, I had to change the entire logic of the code, so I contacted him and asked him to fix it. He fixed it. He made it run on docker container. And then, I added the new feature. However, when the tool runs on docker container, it causes other problems, such as accessing the config file and generating output files inside the containers. For this new issue, I commented it in the pull request and updated the README.md file for temporary solution. Working on a project that has a lot of problems was very tough. It's really hard to know what to fix or change first. Moreover, as I am not the owner of the project, I am not sure how much code or logic I am allowed to change. Having said that, I learned a lot from this experience. I learend that keeping contacting with the project owner or admin helps a lot. Even though it is very complicated, we can figure out a solution together by closely working together. And I am truly glad that I had opportunities to use the new git skills in this lab such as git remote, git fetch, git checkout -B. I am getting more confident with git, although sometimes I still panic.

Top comments (0)