Open-event-server: Add static types in codebase

Created on 23 Sep 2019  路  26Comments  路  Source: fossasia/open-event-server

A lot of benefits can be reaped and a lot of bugs can be caught with static typing in Python using validators and linters like mypy

This is a parent issue tracking various areas where static typing can be added and is reserved for first time and new contributors

https://docs.python.org/3/library/typing.html
https://mypy.readthedocs.io/en/stable/index.html

This issue can be broken down into 2 phases

  1. Add typing annotations

Add annotations in:

  1. Test using mypy

Once enough annotations are added and not necessarily all the points in above step are completed, we want to

  • [ ] Add mypy test in CI to ensure types are passed correctly
chore

Most helpful comment

@chiral-carbon 26 days have passed without any progress. Besides, this issue is huge, there is no way 2 or even 5 contributors will have conflicts or work on same area when adding static types. So, not just 1 contributor can solve this issue

All 26 comments

@iamareebjamal can I take this issue

Take one part of it. Analyze the codebase and tell me which component you'd like to work on

I would like to work with the utils component. Then how should I begin with it?
I suppose there is only one file in utils section which is common.py

@iamareebjamal I would like to take the api helpers part

@Dilshaad21 There are a lot of utilities in api.helpers as well unfortunately

Like this test - https://github.com/fossasia/open-event-server/blob/development/tests/all/unit/api/helpers/test_utilities.py

It is testing things from helpers but they are actually utilities.

Start with common.py and take up utilities in helpers. Anything not related to API is a utility - file utility, compression, text transforms etc

API helpers are directly related to the API, like discount code validation, etc which @sameshl can work on

@prateekj117 @iamareebjamal can I work on the SQLAlchemy models part?

@chiral-carbon Ok, go ahead.

@chiral-carbon If you are not working on this I want to work on this issue.
@prateekj117 I will start by adding annotation and after that, I will add mypy test

@himanshupathak21061998 hey, i'm still working on this.

@chiral-carbon 26 days have passed without any progress. Besides, this issue is huge, there is no way 2 or even 5 contributors will have conflicts or work on same area when adding static types. So, not just 1 contributor can solve this issue

@iamareebjamal okay.

I would like to work on this issue @iamareebjamal

OK

@iamareebjamal Is there a way to check whether the typing annotations written is correct before writing mypy test?
I have began adding typing annotations to auth.py in helpers. Any suggestions?

No such way

Can I work on this issue @iamareebjamal ?

Yes, one more to the list

Hello Sir, Can I work on this issue?

@EkanshMangal Yes, you can.

Yes, you can like the others who mentioned above and never did. So please, instead of spamming "Can I work on this issue?" on every issue, which is very annoying, pick one and send a PR, which by judging previous behaviours of commentators won't happen

Hello, Can I work on this issue.

Yes, please go ahead

Is anyone working on this issue?
@iamareebjamal

Considering it has been 6 months, no

can I work on this issue?

can I work on this?

Was this page helpful?
0 / 5 - 0 ratings