KWOC | Kharagpur Winter Of Code Project Report.
Tags: opensource, devjournal, github, python
Published: 2021-01-08 20:34:49

## *About Me*

Hi, I'm [Tushar Nankani](https://github.com/tusharnankani), currently, a sophomore pursuing Computer Engineering from Mumbai University, and this winter, I worked on a bunch of projects under KWoC.

## *About KWoC*

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bfivx16g78bs00ngq38r.png)

[Kharagpur Winter of Code](https://kwoc.kossiitkgp.org/) is a 5-week long online program for students who are new to open source software development. The program not only helps students to get involved in open source but also prepares them for many open-source summer programs, Google Summer of Code being one of them.

### Overview of my Contributions:

I made contributions to around 10 projects and I will be taking you through them! I won't take you through the code as it doesn't make sense, I will describe my contributions to the projects, instead.

[ Project Owner / Project Name ]
- [ankingcodes/codemon](#codemon)
- [prashantsengar/CleanPy](#cleanpy)
- [sinha-debojyoti/Ookla-Speedtest.net-Crawler](#ookla-crawler)
- [akshgpt7/MarvellOS](#marvellos)
- [Documentive/TemplateBuddy](#templatebuddy)
- [Rohan-cod/newspaper-app](#newspaper-app)
- [xypnox/todxpy](#todxpy)
- [wildfirepy/wildfirepy](#wildfirepy)
- [inaxia/hashcode_web](#hashcode_web)

![gif](https://media.giphy.com/media/Ln2dAW9oycjgmTpjX9/giphy.gif)

---

### Codemon

- [Codemon](https://github.com/ankingcodes/codemon) is a CLI tool to ace competitive programming contests on the website - Codeforces. 
- The codebase of the project was Python. It is a very impressive and helpful tool and I have started using it since I regularly give CP contests. 
- I made a [PR #65](https://github.com/ankingcodes/codemon/pull/65) in which I ***optimized*** the code:
  - use a `tuple` for multiple conditions under one `if` statement.
  - remove unnecessary use of `f-string`.

---

### CleanPy

- [CleanPy](https://github.com/prashantsengar/CleanPy) helps you organizes files in folders and helps you to clean your PC. The codebase is Python.
- I made a [PR #21](https://github.com/prashantsengar/CleanPy/pull/21) in which I ***refactored the code***:
  - remove unnecessary `break` & `pass` statements.
  - followed python's `flake8` guidelines to improve the code.

---

### Ookla Crawler

- [Ookla-Speedtest.net-Crawler](https://github.com/sinha-debojyoti/Ookla-Speedtest.net-Crawler) is a python web crawler that fetches more than 25 billion pages of https://www.speedtest.net to fetch download speed, upload speed, latency, date, distance, country code, server ID, server name, sponsor name, sponsor URL, connection_mode, isp name, isp rating, test rank, test grade, test rating, path. The codebase of this was Python as well.
- Here I made a [PR #70](https://github.com/sinha-debojyoti/Ookla-Speedtest.net-Crawler/pull/70/) in which I improved code *performance*.
  - removed unnecessary `list comprehension` and instead used an in-built python constructor - `list()`. It is unnecessary to use a comprehension just to loop over the iterable and create a `list/set/dict` out of it. Python has a specialized set of tools for this task: the `list/set/dict` constructors, which are ***faster and more readable***.
  - remove `self` - no use of self, the method doesn't use its bound instance. Decorate this method with `@staticmethod `decorator, so that Python does not have to instantiate a bound method for every instance of this class thereby saving memory and computation. Read more about `staticmethods` [here]
(https://docs.python.org/3/library/functions.html#staticmethod).

---

### MarvellOS

- [akshgpt7/MarvellOS](https://github.com/akshgpt7/MarvellOS/) is a basic operating system GUI mock-up built using python's GUI module *Tkinter*.
- Here, I made a [PR #40](https://github.com/akshgpt7/MarvellOS/pull/40) which includes:
  - Opening a file using `with` statement is preferred as function open implements the context manager protocol that releases the resource when it is outside of the `with` block. Not doing so requires you to manually release the resource.
  - When comparing a variable to True, one should always use the form `if x is True` or simply `if x`. Since boolean in python are singletons, identity checks with `is` operator is recommended.

---

### TemplateBuddy

- [Documentive/TemplateBuddy](https://github.com/Documentive/TemplateBuddy/) is an open-source tool for creating resumes and formatting research papers without hassle. The codebase was HTML, CSS, JS & Python.
- Here, I *resolved* a [UI issue #39](https://github.com/Documentive/TemplateBuddy/issues/39) and ***improved upon the webpage*** in the [PR #113](https://github.com/Documentive/TemplateBuddy/pull/113):
  - change in the UI of the templates. `flex-wrap: wrap;` would do the job of creating N * 3 templates. This would also make the page **responsive**
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nev34tmsrag0gwwyo7zn.png)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/eogqft77pfzn6966t8c6.png)

  - Minor changes in the UX: changed to a more *readable and legible* font, improved font size, and add transitions and transformations.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7tgokjaga9x8mbrn7nap.png)

---

### newspaper app

- [Rohan-cod/newspaper-app](https://github.com/Rohan-cod/newspaper-app) is a web app using Django framework. Frontend using HTML, CSS, Javascript, and Bootstrap. Add articles that can be viewed by anyone. Here I worked on the Python part of the codebase.
- I made the [PR #46](https://github.com/Rohan-cod/newspaper-app/pull/46) in which I **optimized code performance and fixed potential bug risks**
  - Add @staticmethods, instead of using self.
  - Remove unnecessary `else` after `return`.
  - Remove multiple imports.

---

### todxpy

- [xypnox/todxpy](https://github.com/xypnox/todxpy) is a simple and easy to use yet configurable todo CLI app built with Python

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/jrp944gh00y4imdeei1y.png)

- Here, I made a *bunch of changes* in [PR #37](https://github.com/xypnox/todxpy/pull/37) which includes:

  - Changing the default arguments.
      - It is recommended not to use a mutable like list or dictionary as a default value to an argument. Python’s default arguments are evaluated once when the function is defined. Using a mutable default argument and mutating it will mutate that object for all future calls to the function as well.

  - Remove unused imported modules [Anti-pattern]

  - Remove unnecessary `else` / `elif` used after `return`
      - `return` statement causes the control flow to be disrupted, making the `else` / `elif` block here unnecessary. This doesn't mean you can not use it, but it is recommended to refactor this for better readability.

  - Remove unnecessary use of comprehension.
    - `raise AssertionError` is preferred over bare `assert` statements. Whenever the use of assert is detected, the enclosed code will be removed when compiling to optimized byte code.
The assert statement is generally for unit-testing or finding issues during the development process.

  - Opening a file using with statement is preferred as function open implements the context manager protocol that releases the resource when it is outside of the with block.

- It is one of the projects I can improve upon even after this ends, it has a great future scope.

---

### WildfirePy

- [wildfirepy/wildfirepy](https://github.com/wildfirepy/wildfirepy) is a Python library for Wildfire GIS data analysis. 
- Here, I made a [PR #96] in which I optimize *code performance* and ***fix potential security issues***.
  - remove unnecessary `dict()` call
  - It is slower to call e.g. dict() than using the empty literal `{}`, because the name `dict` must be looked up in the global scope in case it has been rebound.
  - `raise AssertionError` is preferred over bare `assert` statements. Whenever the use of assert is detected, the enclosed code will be removed when compiling to optimized byte code.
      - The `assert` statement is generally for unit-testing or finding issues during the development process. This does not mean you will necessarily see the error.

---

### hashcode_web

- [inaxia/hashcode_web](https://github.com/inaxia/hashcode_web) is an e-learning platform to learn different languages from the best hand-picked courses.
- The codebase here was HTML, CSS & JS. Here I made 2 important PRs.
- First [PR #11](https://github.com/inaxia/hashcode_web/pull/11) - add ***glassmorphism*** to landing page. 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/u2yjj5esrthijshs2gne.png)

- I also did some ***major changes in the UI*** and *improve the **UX***

  - Switched to a more readable font.
  - Navbar changes
      - add transitions
      - remove background hover
      - improve color coordination
  - footer changes
      - increase padding
      - improve hover effect
      - minor fix of `mailto`
  - Card changes:
      - add box-shadow to the card
      - add transitions when hovered on courses
      - change gif images layout to circular
      - improve the overall user experience 

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zhoozgsst4gz292kq8s0.png)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/zctpuxd06nae1havd6m2.png)

---
 
That's it from my end, hope you had a fun read! 

![gif](https://media.giphy.com/media/dvrb6Nhg0sD8oPleea/giphy.gif)

---

## *My Overall Experience*

- My experience with KWoC was great.
- Got a lot of exposure:
  - Difference between good, bad, and a well-written codebase.
  - How a project can be maintained effectively.
  - Became fluent with Git and GitHub.
  - I also made a bunch of issues while testing code, that I could not fix but could be addressed. 
-  It was a great learning experience for me and not just tech-related, I learned that *communication is the key* to everything.


I came across a lot of projects, that gave me so much *exposure*. I will look forward to these projects and more in the future, as all of them have a great future scope. I also look forward to joining in as a mentor in the coming years. 

Also, one doesn't need these events that happen in Summers or Winters to contribute. You can start contributing!

> And the best time to do it is right now, today, because tomorrow, typically means never.

That's it from my end! 

Tushar Nankani
[GitHub](https://github.com/tusharnankani) | [LinkedIn](https://www.linkedin.com/in/tusharnankani/)