This post isn't about a specific repository, or pull request - but about the general beginner's philosophy around contributing to an open source project. However, I should begin by explaining what got me thinking about this subject.

While building this website I found I had two uses for emails: the first was to send email notifications when someone replies to your comment, and the second was to send newsletter-style notifications when I post a new blog post (for those who are interested in my continued posts). I wanted to use the same base template for both of these email styles (to increase code reuse, and for a consistent experience), and to keep my templates clean I wanted to use a premailer.

Far more email clients support HTML emails that have styling inline on elements, rather than embedded (or god-forbid - on an external style sheet). A premailer takes HTML with embedded CSS (i.e. within <style> tags) and outputs HTML with that CSS inlined (i.e. within <div style=""> tags). Premailing is extremely useful for keeping templates readable, but still having well-supported styling.

I knew that I could use Python Premailer in cases where I had direct access to the sending of the emails (i.e. for comment notifications, since I wrote the code to accomplish that), but that wouldn't work with Django Newsletter since I had no obvious way of intercepting the templates before sending. There was an open issue to figure out the best way to accomplish it, but when I first came across the problem, no solution was proposed.

I posted a question asking if it was possible to use a premailer and Dokterbob (the maintainer of Django Newsletter) suggested I use a template tag and pointed me to Django-Premailer. I installed the app, but found it throw exceptions when I tried to use it. I noticed there was an issue regarding this very problem, and that it was only a problem in Python 3.

The problem was with an API import in the template tag code that had changed in Django under Python 3 - so I copy and pasted the template tag code into my local app, fixed the import and was on my way.

I realised a couple days later that other people using Django Newsletter would probably be interested in knowing how to get a premailer working, and Dokterbob prompted me to write a small blurb in the documentation. I forked the repo, cloned it locally, added a couple lines about how to integrate a premailer. I committed and pushed to my fork, then submitted a pull request (referencing the original issue).

The whole process took about 15 - 20 minutes, and Dokterbob pulled in the changes the next day. But, do you know what the great thing is? People actually thanked me for it. In fact, the original issue poster gave a very nice thank you message. All I did was write a couple lines documentation about my research into getting a premailer working, and show an example - but people were so grateful. I also decided to submit a pull request to fix Django-Premailer, but the creator hasn't responded yet (but if anyone wants to use Django-Premailer in Python 3 they can just use my forked version).

If you're not sure about version control (Git, or otherwise) there's zillions of tutorials out there. You can get it installed and understanding the basics pretty fast. The GitGuys have a suite of tutorials that should help with any aspects you're stuck with!

The thing I got from this, is that I always assumed contributing to open-source projects involved a lot of time, and more importantly a lot of information about that project. I realised that the vast majority of open source projects are really missing documentation (and documentation is oh-so important), and also code examples.

So maybe you figured out how to accomplish a task using a library that wasn't very well documented. Or maybe you have a code example that could be useful to other people. You should REALLY consider contributing to the documentation, or maybe just making a post about how to accomplish that task. You never know how grateful people might be to your (seemingly simple) contribution.