Contributing to Open Source

I've been very quiet on this blog recently, mainly because I was trying to get started contributing to Open Source projects. I wanted to start giving back for a very long time, but never got around to actually start contributing regularly.

This all got started by Troy Hunt introducing Pwned Passwords v2 back in February. The same night, right after reading Troy's article, I quickly spun up a python project leveraging the K-Anonymity method and checking for compromised passwords offline. While refactoring the project to upload it to pypi, I introduced a nasty bug causing the script to stop functioning. A few days later, I found a Pull Request in my repository, fixing the bug and repairing what I had broken.
The simplicity of doing this amazed me - I merged the PR, released a new version and decided that I should finally find a project I can contribute to myself.

A few days later, I stumbled upon a project to which I since contribute regularly. It's only been a few months, but I feel that I'm going to keep working on this project for a while - as I really love the code-base and direction the Project is moving to.
I do link to the project below - but I don't think it's important which project it is, as this article is about contributing to Open Source, not about which project i picked.

How to get started

Picking a project

In order to get started, you needed a project to contribute to.
My main selection criteria are below:

  1. a small to medium size project, which already has multiple contributors (only one contributor might mean that he is not open to contributions), but not too many (huge projects mostly have also a huge code-base.
  2. the code base shouldn't be too big, so getting into it does not take weeks or months.
  3. It should be in a language I am familiar with and actively use (this way, I can get the most out of it for myself, as it's both practicing what I know, and learning new stuff as other developers will tackle problems differently).
  4. I should be using the project myself either now or in the future, otherwise I'll loose interest soon (my goal was/is to get actively involved longer term - not do one-off contributions).

I was not actively searching for a project, but stumbled upon a very interesting project, which happens to be freqtrade - a Trading Bot written in Python, with a few core members, a good community contributing and bringing the project forward, doing very good code reviews on pull requests (which I feel is important, as it helps bring my own coding to the next level) and a good test-suite.

What is in it for me

While working in Open Source does require some spare time, I feel that the time is a good investment.
It allows me do what I love, while also collaborating with others doing what they love. This project was actually a very fortunate pick, as it brings together programmers with traders, which happen to understand the market, so I was able to get some different views on the same topic, which should help me seeing the business case for the applications I work on in my Job.

Having my code reviewed

By far the best thing is to have your code extensively reviewed and commented on. This exposure may seem intimidating at first, but its one of the best things in open source. Someone is thinking about what I wrote, trying to understand it, and may help get it corrected - or show a better way to accomplish the same thing.

Doing code reviews

I also helped in reviewing code myself, which thought me a lot by understanding how others tackle a problem, discussing the solution in case of doubt and helping others by providing a different view on a problem. Even if you don't comment on a PR, still read through the code, try to understand the intention of the changes, it'll help in understanding the project (and the direction the project is moving towards).

Patience

Contributing to Open Source will require patience. I read this before, but it's absolutely true, so when I did my first contribution, I didn't even expect it to be merged (it was merged, after doing a few modifications which came out from the Code Review).
After submitting your first Pull Request, you will need patience. Core contributers may not be around immediately to review your code. It may take days, weeks or months depending on the size of the project until your PR is (eventually) merged or reviewed - and there is nothing you can do about this.

Testing

While working on this Project, I got exposed to pytest for the first time. I had heard about it a few times already, but never got a chance to actually use it. This project gave me the chance to do so, with a good base to start with (reading the code already in the repository). It does not matter which test-framework is used in the end - but having good tests is very important to not introduce regressions.

Wrapping up

I will definitely continue to contribute to Open Source Projects. Time will not always allow me to contribute at the same pace, but that's fine. I am not forced to do any of this, but I still try to help because I like doing it, and I can learn new things by contributing.

If you're a developer, trying to learn new things every day, you should try to contribute to open-source projects as well (if you're not doing that already). Many projects have a good community (if they don't, consider finding an alternative project) and there is always something new to learn (or someone to be taught something new). Learning new things by doing Courses or reading articles is important too, but it's equally (if not more) important to apply the knowledge - that's what will benefit you the most.

Matthias

Read more posts by this author.