Everybody Struggles : Outreachy Week 3 4
I heard about Outreachy from the seniors at my university who had been alums of the program. So, I definitely, had to carry on the legacy XD. Jokes apart, I got to know from them how the program helped them overcome their self-made barriers about making changes significant to a greater proportion of the world, how they got to meet and learn from many amazing people out there, how they made an impact on the organization and consequently, the users through their work. And, last but not the least, how this proved to be a starter for their upcoming career and life as programmers by giving them a first-hand experience of how the software industry works! Fast forward to the beginning of the internship (the journey till here is described in the previous blog post in great detail), I was very excited and looking forward to a lot of learning and contributions. Well my project was creating/ improving documentation for one of the world’s most widely used Python libraries, yeah, talk about pressure! One plus point to the situation was during the making of the project proposal, I had sorted out most of the areas that needed work. This kept me from deviating from what the original target was. Making a roadmap ahead of time helps you plan out things, and subsequent steps to deal with them. I was mostly trying to get a gist of what I have to work on, which was C-API of NumPy in my case, which is strongly interdependent on the Python functions in the core library. As a user, I had always used Python functions and had little to no experience with the C side. One of the first issues I was trying to solve was deprecating a few functions which served very trivial purposes. There were a few documentation changes here and there and very minor modifications in the functions, or so I thought. I did them and pushed the changes - around 800 tests failed! It was clear, that I needed an alternative for the functions being called, but could not identify at first go. Looked around a bit, found that deprecated ones used a particular flag, searched for the places where that flag's value is being set/unset. Developed a rough approach, discussed with mentors, and clarified my doubts before making changes. After a few rounds back and forth, I was able to get the builds running, but here is what I learnt -- If you have to deprecate a well-in-use function in NumPy, follow these three steps :-
- Modify all the tests which use the particular function to use an alternative of the same.
- Add warnings in the function body, so that builds fail if someone tries to call the deprecated functions in future.
- Add tests to check if the functions are deprecated, that they throw correct errors on being called.
- Lastly, remove the documentation explaining the function or add (deprecated) wherever it is mentioned so that no one refers to it and uses a deprecated function in his/her code.
Getting stuck and struggling is an integral part of learning. Zero challenges, zero learning curve. But getting out of the problem is more important than getting into the problem. I am not sure if this will work for everyone, but I hope will definitely help some. If you're stuck -
- Google, Google some more, and more. Its such a high chance that you're not the first to face the particular problem unless its too specific to your project and you don't have documentation for reference. Most of the problems encountered while initial setup are system issues and can be easily solved by looking around and tweaking with the system itself, don't mistakenly purge your Python2.7 though if you don't want your Ubuntu desktop to disappear (yeah, I did that once!)
- If the above doesn't work after 2-3 tries, ask on IRC or public chat of the community, you will get an answer very soon unless its a public holiday.
- If nothing works (which is very very unlikely), contact your mentor. Ask the right question to the right people, tell them what were you trying to get at, how did you approach the problem, what all did you try to solve and finally ask how to solve it; often helps in narrowing down a lot of things, plus point being now you know what all doesn't work in addition to knowing what does work!
- Don't get stuck for indefinite time, in the ego of solving on your own at any cost. Putting 3-4 hours is good, but anything more 6 hours is sheer waste of time. Just ASK! no matter how silly your doubt seem to you.
Rest in the next edition!