DEV Community

Pavel Belokon
Pavel Belokon

Posted on

Writing My First Pull Request

This week in my OSD600 course, I was tasked with contributing to another student's project by implementing a Markdown parsing feature to their static site generator.

One of the cool things I discovered was the ability to link an issue to the pull request simply by using its number. This was a GitHub feature I never knew about.

I have picked ez-txt2html by Bryce Seefieldt since I have never tried writing Python 3 code. My only significant experience with Python was during my high school years when I was developing a Pygame-based evasion game (sadly, I don't have the files to link and show it).

Let's talk about the pull request and the issue I was working on this week.

The process was straightforward. I created an issue on the project, and then the owner assigned it to me. Once I had completed my changes, I posted my pull request and linked it to the issue.

What I did was use the re library of Python, which allowed me to employ regular expressions. Whenever the program read the .md file, it would parse it with the help of these regular expressions. Since we were constrained from using any markdown parsing libraries, I found this approach to be both easy to understand and modify, as parsing solely depended on the way the regular expressions were written.

The owner of the repo merged it quite quickly since I tried to match the style and structure of the code as closely as possible to the original and touched the main logic as little as possible.

The only problem I encountered was installing the project and getting it to work locally because we had not created proper contribution instructions or a wiki for our projects yet. I had a conflict between the Python version on my computer and the one that the project required.

I learned a lot about contributing to open source, and when my pull request got merged, I felt incredibly proud and happy to see my code in the main branch. This experience fired me up to look for repositories to contribute to during Hacktoberfest. Slowly, I started to understand how to participate in open source, although I haven't tried contributing to any big projects yet.

Top comments (0)