Coming Full Circle: Contributing to the Python Project Matrix-Nio

Somewhere around 15 years ago, I started learning Python because I’d gotten deep into genealogy and started using the free and open source project Gramps. As I was also pretty deep into free software (somewhere around that time I became a supporting member of the FSF for a few years – and I think my smile.amazon.com still donates to them) I got interested in the idea of helping projects by contributing code. Python seemed like it wasn’t too hard to learn (compared to C++), so I started learning. I never did end up contributing to Gramps as I found GUI programming incredibly hard. In fact, it was something like 6 years ago before I created some useful GUIs (that weren’t copied out of tutorials) and only last year that I started making good, competent GUIs using the QT toolkit.

Slowly I created more complex Python programs that solved various problems I had. But it was in 2019 that I started making complex projects with pytest, flake8, learning about decorators, etc and started reaching a certain level of mastery in the language. (Which is not to say mastery of the language, but certainly rising above casual tinkerer beginner level)

Also, long-time readers of the blog know that I support self-hosting so that you’re not the product and also so that services can’t be yanked away from you, so recently I started running my own matrix.org server, using the Synapse reference implementation. (In case you don’t know, Matrix is a federated version of a Slack-like app – basically IRC on steroids). As part of my garage IOT project, I wanted to have it be able to send a message into a Matrix room to let me know if the door has opened or closed. So I needed a Python library to interact with Matrix (rather than speaking at the level of http GET and POST urls). That led me to matrix-nio, the library recommended by the Matrix devs since they’re unable to maintain their own Python SDK.

I wanted to be able to have the user try and register their bot if they didn’t already have an account for it on their matrix server, but matrix-nio lacked both registration and deactivation methods. I put in a feature request for those features. When poljar, the project maintainer, marked it as a good issue for a beginner, I decided to jump in and try and implement it myself. It wasn’t easy – it involved Python’s async library, which I know nothing about, and a way of implementing the repo that was very different from the way I would have done it (not wrong, just different – and probably more like how I should do it given poljar’s experience programming). But I’m now the 3rd biggest contributor to the code base and I still haven’t implemented my deactivation code!

It’s pretty awesome to finally be able to give back to an open source project! I hope many others will be able to benefit from my code.

Published by Eric Mesa

To find out a little more about me, see About Me