My First Contribution To The Open Food Facts Organization
As a beginner...
Imagine stepping into this bustling hub of ideas, where everyone's sharing what they know and building cool stuff together. That's what diving into open-source contributions feels like! And guess what? I recently got my foot in the door by chipping in over at Open Food Facts.
You might be wondering, "What's Open Food Facts?" Well, it's this awesome global project that's all about gathering and spreading info about food products worldwide. It's like a superhero for nutritional transparency!
I can't wait to spill the beans on my journey. I'll walk you through the steps I took, the hurdles I faced, and the lightbulb moments I had along the way. So, come along for the ride as I share how I became a part of this buzzing community. Who knows, maybe it'll spark some ideas for your adventure in open-source contributions!
Exploring GitHub and contributing to Python Repo's
I learned how to use GitHub and made some contributions to Python repositories. Recently, I came across an organization listed in GSoC 2022. I went through their repositories and found a "good first issue" in the "facets-knowledge-panels" repository. While I'm still a beginner and don't fully understand the code, I did manage to grasp some details from the README file.
Contribution...
The issue involves adding test cases to different knowledge panels and organizing them into separate test files. While I might not be entirely familiar with adding the test cases just yet, my initial focus is on the task of separating them into different files.
I thought it was easy, but after submitting my pull request, I discovered that some checks were failing. I didn't initially understand why those checks were failing. It took me a while to figure it out. The checks included things like auto black, code scanning, and code quality. The project maintainers recommended using "make lint," which was a term I hadn't heard before.
Learnings...
This led me to learn about something called linting. Additionally, I installed "pytest" to check how well my code was written. Because of the auto-black check, I came across "black" and used it to format my files. I also discovered "isort," which helps organize imports in a neat and organized manner. It automatically separates them into sections and sorts them alphabetically by type. Additionally, I learned about GitHub actions and workflows.
I encountered difficulties with the code quality check, as it kept failing with numerous errors. During this time, I submitted multiple pull requests, addressing one issue at a time. However, after making a PR, I wasn't sure if it would work unless the maintainer ran the workflow. Unfortunately, it seemed the project maintainers were quite busy. This process added a significant amount of time to resolve the issue.
The last thing I did...
I had an idea: what if I could run the workflows in my repository? I discovered the "workflow_dispatch" feature that allows this. Knowing I'm still a beginner and can't alter the workflow file directly, I created a new branch forked from the one where I'd made some changes. I included the "workflow_dispatch" in the pull request workflow, allowing me to run it in my repository. This gives me more control over the process. This way, once all the adjustments were made, I could submit another pull request if the code quality check passed successfully.
I made adjustments to the files based on the errors I found. I ran the workflow over 50 times to ensure the code quality check passed. Finally, I submitted a Pull Request after resolving the issue, and it got merged. That's how I made my first PR in this organization.
Conclusion...
What I want to emphasize is that by working on just one issue, I ended up learning a whole lot of new things. It got me thinking: if I tackle more issues, I can keep learning and growing. It's proof that "we truly learn by doing".
Getting involved in open-source projects is a great way to pick up new skills. It's not just about learning; you also have the chance to meet people who share your interests and expand your network.
So, I'd like to encourage everyone to dive into tech-related activities. It's a great way to learn and grow in the field.