So, You want to Contribute to Cpython : Gather here !!

Joannah Nanjekye
Shared by Victor Stinner on Twitter during Pycon 2019

Cpython is the open source project that gives us Python releases. I have used Python from 2012 when I was still at University because it is more fun to write Python.

Over time, I have been contributing to open source and decided I wanted to start contributing to Cpython in 2017. I reached out to Nick Coglan, by then the only Cpython core developer that was following me on twitter. He sent me a link to the Cpython Developer guide.

I cloned and compiled Cpython successfully but that was it. I could not decode anything on the bug tracker :) . By this I mean I could not find an issue that I understood enough to get to the next step. I kept the Cpython clone on my machine anyway and forgot about it.

Late 2018, I developed interest again to understand the internals of Cpython for some of my future now current work but also personally.

Through mentor-ship for a specific time by another core developer Victor Stinner, I was able to start contributing to Cpython 🎈. My first merged PR being in January this year (2019) because I had other things to do then. I don’t have so much bandwidth to contribute but when I have time, I try to open pull requests. I so far ;

  • Have 13 merged pull requests. (5 enhancements, 2 docs and 6 general bug fixes)
  • Have 5 open pull requests.
  • Got bug triage permission.

I noticed that it is possible to become a Cpython contributor in any other way because you may not have mentor-ship as I did. There is a core mentor-ship mailing list that you can reach out to for help but sometimes core developers may not offer time to mentor because of different reasons.

I will try to explain how you can start contributing to Cpython borrowing from some few ways I have used and found to work for me. In this blog, I will give some tips for;

  • Getting started.
  • Getting tasks.
  • Submitting a change.
  • The review Process.

Getting Started

Cpython is open source and the source code is on GitHub. The best place to start is to visit the Cpython developer guide. It has all details on getting the source code, compiling it and all relevant contribution information.

Getting tasks

Like I hinted earlier, this was my hardest and I believe many people can relate.

0. Bug Tracker

Cpython issues/bugs live on the bug tracker at least for now. They may move to GitHub in the future after PEP 581 is implemented.

For the record even issues labeled as easy on the tracker have some complexity so I would not promise the easy issues are actually easy.

I usually use the random issue button on the bug tracker to read through the bugs/issues. I will note down the ones I kinda understand and know how to approach. You can use any way of tracking these issues.

I personally have a private project on GitHub where I track my work on Cpython something like this;

You may not be this thorough but I decided to track this way for my own convenience because I plan to contribute more.

These are issues I singled out from the tracker that are clearer to me, but also are not still being discussed. This is important because If people have not yet come to a consensus on the issue, working on it may lead to your changes not to be considered.

Remember to check if someone else is not working on the issue and leave a comment on the issue when you start working on it. I some times don’t comment and just open a pull request for issues where no one is working on because I don’t want to promise and not deliver.

  1. Talk to PEP Authors and/or Core Developers

Another way to scheme for potential tasks is to talk to PEP authors if they need any help on small tasks. I usually send an email to a PEP author whose work am interested in and see how I can help.

Tell him or her about your background, skills and your particular interests. You can find things to work on this way. This is a good way because you force him/her to detail small potential tasks to your level of understanding. This also fills the blanks you feel on the bug tracker because when you are new, the bug tracker is complex to understand sometimes.

If you also find a core developer, discuss some potential gap you can fill on the project in terms of work to be done. The truth is there is too much work to be done on Cpython.

When in doubt just ask, what urgent thing can I help with on Cpython. I would expect a core developer to be able to answer this question with some clarity to you.

2. Use an Exploratory Approach

Sometimes, I will just open a module’s code, try to understand how it works and as you do, you may find a bug. Open an issue on the bug tracker and try to fix it. The issue can be anything a typo, documentation, a missing doc string, a missing test etc.

Most times, if you are a Python user, you will find some things you feel you can improve. Share your ideas on the Python-ideas mailing list for discussion especially for bigger changes. For small things like typos, missing docs etc just open a pull request.

3. Follow interest

Think about it, there are many things you can work on -on Cpython but you feel a sense of achievement if you work on something you love or are interested in or a pressing bug or feature.

You are not paid to do this anyway, you are trying to improve a tool you use for work or as a hobby. It may not pay off for you now but may be later.

I personally set out to work on issues that interest me. I don’t just open pull requests. Am curious about the C-API and sub-interpreters currently so I look at this code often when I have time off my day job. Am scared of documentation for example because am not a native English speaker.

Submitting a change

The general rule for starting on a new open source project is to not be very ambitious about your first PR. Start with something small a typo, documentation and keep building complexity. You can be ambitious If you want though.

In my experience, contributing to Cpython for the first time can be tricky as there are many things you need to do and know as compared to other projects. Therefore having a simple task will first orient you on the cycle of a pull request on the project.

New changes to Cpython are submitted as pull requests. Read the developer guide for all details. As good practice, make sure you meet the requirements of a quality pull request i.e working and tests running green.

If in doubt;

- Compile the source

- Run all tests

- Run make patchcheck

Also, feel free to open work in progress (WIP) pull requests If you want to discuss what you are working on or confused about something. I open these when I need to ask a question or need help to understand something.

The Review Process

When you open a pull request, cc some potential reviewers . This will be like a ping to them.

Cpython has about 950 open pull requests right now. The number can rise to over 1000. Exercise patience as core developers can be busy because they have other things to do like, jobs, families etc to take care of. Open source is a volunteering initiative so there are no guarantees of a predictable response.

So, don’t give up! I do not expect any escalation of any sort for feedback. But from my experience, someone always shows up to review your work. It may just not be at your pace.

Merging a pull request is a great responsibility as the person merging will maintain this change for some time. There may be some back and forth but it is reasonable and necessary to just ensure the right quality of Python release is shipped.

Conclusion

I can say with all certainty that the Cpython community is warm . It has been for me.

I keep contributing because of the community any way. I personally hang around for also the kind words for my contributions. Like these ;

If you want to contribute to a project with a warm community as you better Python, where your contributions will be valued, you can work overtime If you want :) I mean you can open a PR anytime, most importantly be thanked like me :), then come contribute to Cpython.

Who will bring balance to the source ? May the force be with you as you contribute!!!

Joannah Nanjekye

Written by

Doing GC stuff with IBM/UNB. Software Engineer, Aeronautical Engineer not Female Engineer 🤨 @RailsGirlsSoC , @outreachy and @recursecenter alum.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade