Behind the Scenes of Coding

During my Outreachy experience, I often felt like a complete beginner. One of my first challenges was creating pull requests (PRs). As I started contributing to open-source projects, I quickly learned about the CI pipeline, which frequently popped up—and broke! I apologize to anyone affected by my failed attempts to pass checks (you probably received several emails about it 😜). These experiences taught me the importance of testing locally first. This seems obvious now, but moving forward and making changes are essential for growth. Outreachy provided a safe space to make mistakes without judgment (I think so) and to learn from each misstep.

Continuous Integration

Continuous Integration (CI) ensures that code remains in a workable state. CI checks perform extensive work to prevent bugs and errors from leaking into the main branch. During my contributions, especially to projects in Rust and Python, I encountered useful tools for maintaining code quality. While creating PRs for HOTOSM, I used pre-commit hooks. Pre-commit is a Python tool that simplifies and applies Git pre-commit hooks, performing tasks like linting and formatting automatically.

One of the similar tools I used was flake8, which is great for ensuring consistent code formatting and preventing unnecessary changes between different editors.

My mentor at HOTOSM, Sam Woodcock, who has been an incredible support throughout my journey, shared the installation steps for pre-commit:
pip install pre-commit
pre-commit install

As the name suggests, these hooks run when attempting to make a commit, auto-formatting the code and reporting any errors. To run hooks manually, use the following command:
pre-commit run --all-files

Learning to Write Tests

Testing is often the least popular part of coding, and I was no exception. Initially, I didn't write many tests, but I realized their importance when I wrote my first test using Pytest for an osm-fieldwork project. Even then, I extended an existing test to cover a new boundary, which helped me understand the importance of edge cases in testing. As an intern, I had the opportunity to contribute to various projects, including one that involved writing tests asynchronously. Although I was new to FastAPI, my experience with Flask and Django Rest Framework was helpful.

FastAPI is a popular framework known for its high performance and suitability for building RESTful APIs. Through this experience, I learned the importance of writing comprehensive tests to ensure the code works regardless of who developed it and to prevent breaking existing functionality.


To conclude

Reflecting on this journey, Outreachy has been a tremendous learning experience, allowing me to grow both technically and personally. The support and guidance from my mentor and the community have been invaluable, helping me navigate challenges and celebrate successes.

References:

Header image by Firdouss Ross on Unsplash

0
Subscribe to my newsletter

Read articles from Azhar Ismagulova directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Azhar Ismagulova
Azhar Ismagulova

Hey, I am a software engineer based in London.