How To Contribute To Open Source Python Projects

Open source projects thrive on contributions. Not just code contributions, but also documentation, examples and testing. This tutorial will help you understand how you can contribute to open source Python projects, and make your experience in contributing more successful.

Have a look at my blog post on contributing to open source project, both in Python and JavaScript. I’ve touched upon what you should expect from contribution, how to interact with projects as a newbie and how you can use the different social networks to stay in touch with fellow contributors.

Why contribute to open source projects?

There are a number of reasons to contribute to OSS (open-source software). Let’s see what motivates developers to contribute.

First, there are a lot of enthusiasts who simply believe that code should be open. They’re idealists who want to make the world a better place, and it drives them to contribute code. The desire to share can be a powerful motivator.

Second, OSS gives you a great start. Beginners might start by fixing minor things, such as a bug in a library, sending a pull request, or even writing a piece of documentation. However, beginner developers can also learn to write so-called “clean code” – code that is readable and maintainable – while contributing to open source projects. When developers realize that their code is exposed to the world, it makes them focus on making that code easy to understand and support. Programmers stick to generally accepted rules within a team, which include norms for indents, descriptions of methods and classes, variable names, and following the don’t-repeat-yourself rule. In a nutshell, when contributing to free projects you’re obliged to conform to the norms of a project.

Third, you get the chance to be part of an active open source community where you can meet like-minded people and supporters. Moreover, if you’re a freelancer and actively contribute to open source projects, you increase your chances of being noticed by potential employers.

The main reasons why developers go for free-for-modification projects are to be recognized, to sharpen their programming skills, and to become part of the vibrant community. Now let’s look at what you should consider before you start contributing.

Start small

When approaching project creators, ask them if you could help with something small. It can be fixing typos or even cleaning up the documentation.

Maintainers of open-source projects appreciate it when first-time contributors offer to help in simple tasks like improving the project’s documentation, simply, because nobody else is willing to do it.

Smart developers who maintain open-source projects may ask “Imagine that you’d want to learn everything you need from this documentation – how would you improve it?” They realize that the task means the potential contributor will get to know the project from the inside out.

Starting out with the documentation offers an excellent opportunity for getting your foot in the door and making yourself known. This should set you up for future opportunities to contribute to the project.

Familiarize yourself with the project

Once you find a project that aligns with your interests and skills, the next step is to get a sense as to how large and how active the project is.

A good way to get a sense of the pulse of the codebase is to look at the right-most column of the project. This gives an indication as to when certain files were last updated.

Let’s look at an example of an inactive project. Note that the last time most of these files were modified was 4 years ago. This is a project that perhaps at one time was more active, but is currently either in a stable enough place to not require updates or is a project that may have been abandoned or replaced by another project.

Inactive Project
Inactive Project

Inactive Project

Alternatively, here is an example of a more active project. Note that some of the files have not been updated. This is common, especially for certain files that are not expected to change drastically over the course of the project lifespan like the .gitignore.

However there are many files in this repository that indicate that the last time they were modified was either 4 days ago or 9 days ago. So, it seems as if the pulse of this project is a bit more active and perhaps more suitable to contributing to.

Active Project
Active Project

Active Project

While it’s certainly fine to take an inactive project and build upon it with your own features and extensions, it can serve a benefit to a newcomer to be part of an active community.

Once you’ve found a suitable project that is of interest to you and ideally is somewhat actively maintained, perusing the source code and looking through the project structure can be a good way to see the intent, style, and other attributes of the existing project.

Depending on the size of the project, this can be more or less involved task, but the “meat” of the project can usually be isolated to just a few spots. Spending your time here and reading through the source code like you’re reading this article can be an insightful and surprisingly enjoyable task.

Get to know GitHub

GitHub is the most popular platform for open source collaboration, so you’ll probably use it when exploring the world of OSS. First, you need to create a GitHub account and read the guide that helps you get started. On GitHub, you can contribute to projects by submitting issues and contributing code. Submitting issues means sending messages about errors in applications and suggesting ways to fix them. Contributing code involves sending pull requests with your corrections and improvements.

Making a pull request

Once you’ve isolated the task you want to contribute, the next step is to submit your code and make a pull request to the project to incorporate your code into the master branch.

Before doing so, it’s typically a good idea to see if the project has any contributing guidelines. These guidelines typically include things like code style to maintain in your branch and what information to include in your pull request. If such a template exists, ensure you abide by it.

Once your local branch to the project is at a point where it implements the feature or solves the issue, it’s time to make a pull request.

You can either make a pull request via the command line or through GitHub. As this is a topic onto itself and is well beyond the scope and intent of this post, more information about how one should make a pull request can be found on the official documentation page for GitHub.

Learn the basics

When working with GitHub, you should know how to use Git – one of the most popular version control tools (also known as revision control tools). Because developers constantly make changes to their code, they need a system that can manage those changes in a central repository. In this way, everyone involved in the development process can download a given piece of software, make changes, and submit updates.

Iterating from feedback

Once you have submitted your pull request, it’s up to the project maintainer or maintainers to review your submission. Depending on the scope of the task, the scrutiny of the project maintainers, etc., this can take a bit of back-and-forth discussion.

This perhaps should go without saying, but throughout this back-and-forth review process, it is important to dissociate yourself from the code you submitted. Any criticisms or suggested changes are (or at least should be) delivered to you in a constructive and helpful manner. You should respond to these in turn with professionalism. After all, the shared goal is to work together to enhance the existing code to improve.

Once the reviewers are satisfied with your code and any follow-up changes, they will typically merge it into the master branch of the project.

All skills are welcomed

Even non-programmers can contribute to open source projects! Documentation is needed for all projects, and sometimes this is poorly written and maintained. Thus, you can help by writing, updating or even translating documentation. Also, your design skills might come in handy: every application needs an interface, after all. Finally, you can contribute by managing a community by replying to questions and guiding newcomers.

Wrapping up

Congratulations! You’ve hopefully used this process to contribute your unique set of skills and knowledge to make the world just a little bit brighter. Or, perhaps you dove in head-first into making your first pull request for what will be an interesting career path ahead.

In any case, welcome to the world of open-source software development!

spaCy

Python Spacy

This is an open-source software library that deals with Natural Language Processing and is written in Python and Cython. While NLTK is more for teaching and research purposes, spaCy’s job is to provide software for production. Also, Thinc is spaCy’s machine learning library featuring CNN models for part-of-speech tagging, dependency parsing, and named entity recognition.

Djoser

This is our library for implementing login mechanisms, user account setup and management from the REST API level (using Django REST Framework). We’ve just released djoser 2.0.3 with a host of new features. For example, we added the option to set ‘permission_classes’ for standard djoser views in the app settings.

Conclusion

Have you ever wanted to contribute to Open Source projects without actually knowing where to begin? This guide will help get you started and answer common questions like “How do I submit a pull request?” and “How do I develop Python?”. Well written by an actual contributor who has been contributing for 5+ years.

0 Comments

No Comment.