[GSoC 2020] Django-Stubs Mypy plugin

Hello everyone!

First of all, I want to apologize for not contacting the community since results were announced. I had a lot of hard work at Uni, as my semester finishes by the end of June. I will do my best trying to combine both GSoC and Uni in the coming weeks. I also hope that Uni authorities will decide to postpone my exam session until September, so I will be completely free to code in July and August.

Second, as I mentioned in my proposal, I want to start with a good plan to stick with, so my work will be more effective in the following months. I’ve went through Mypy documentation, but I feel like I still need a lot more knowledge on Django-Stubs codebase. To choose something to begin with, I think we have to decide if I should focus on refactoring the plugin, basing on existing codebase, or I rather should start the whole thing from scratch. TBH I’m a little bit afraid of choosing the second option, as it seems to be impossible to finish spending only 30 hrs a week on this project.

Assuming I’ll get a green light to focus on refactoring and/or rewriting only some parts of code that require it, I would like to stick to the plan I presented in my proposal. The first step was:

Having a bright plan in mind, I will start by fixing Manager.from_queryset() and Queryset.from_manager() calls. Solving this will create a good foundation for further work, and will be a measurable milestone. Parallel to writing the code, I intend to write documentation and tests for created solutions. (…)

Mr. Sobolev sent me some resources on this one a few weeks ago, as there already exists PR #290 by Mr. Kurnikov, which seems to be a good start. I could start investigating the code, and later fetch the PR branch into my local repo and continue working on this (or to get proper permissions on the repo, so I could work on this directly). What do you think about this? If it’s a good idea, I’d love to get some more info about what has to be done so this PR would be ready to merge.

It would be great to get some feedback on my ideas, in particular I would like to know what are my mentors’ expectations for, let’s say, next two weeks. All suggestions and tips are welcome!

Let it be fun.

Regards,
Kacper

2 Likes

Hi Kacper,

I had a lot of hard work at Uni, as my semester finishes by the end of June

This is totally fine. Your education is very important, so, please, no rushing there :slight_smile:
(That’s a University Professor speaking in me right now)

It would be great to get some feedback on my ideas, in particular I would like to know what are my mentors’ expectations for, let’s say, next two weeks.

I would say that you can start when you are ready. This would be the most productive approach. Finish all your Uni-related tasks and then let’s start some serious work.
In the meantime, we can work on different small fixes, that do not require a lot of concentration.

To choose something to begin with, I think we have to decide if I should focus on refactoring the plugin, basing on existing codebase, or I rather should start the whole thing from scratch

I would totally go with the first option: refactoring. We have a lot of new features here: Rewrite to incorporate __class_getitem__ present and other stuff by mkurnikov · Pull Request #366 · typeddjango/django-stubs · GitHub

So, fixing and merging this will be a very good start. But, this does require a lot of time and effort. Me and Maxim are going to assist you along the way. We can be in quick touch in Telegram. Maxim also has one, so we would be there together.

Thank you for your answer! I’ll start investigating PR #366 soon, and do some minor fixes in the meantime, just like you suggested :smiley:

Could you please contact me via telegram whenever you have a spare minute? I was trying to search you, but there are a few “Nikitas” out there :grin: My telegram nickname is same as my forum nick, “kszmigiel” :slight_smile:

Hi @kszmigiel — I see you’ve been up to lots. Nice :+1:

Can I suggest you spend a moment to pull together a list of activities that we can point to for the first review?

Beyond that, how are you getting on? Is there any extra support you need? (As I say, it looks like you’re doing great.)

Kind Regards,

Carlton

1 Like

Sure!

Here’s the list of my already merged pull requests (since the beginning of June). Sorry for no links, as a new forum user I can insert only two links per post.

  • PR #376
  • PR #384
  • PR #387
  • PR #390
  • PR #391
  • PR #396

There was also merged PR #383 which was based on my PR #354 I didn’t manage to finish. I was also reviewing PR #374

At this moment I have 3 issues assigned to me by @sobolevn :

  • Issue #312
  • Issue #373
  • Issue #402

which I will start working on this weekend. I’ve also posted my first GSoC vlog video on Youtube yesterday.
Here’s the link: https://www.youtube.com/watch?v=YwSAlYS6-fI (turn on english captions :slight_smile:)
I plan to continue shooting videos on GSoC, Django, typing etc. in the nearest future.

Well, extending day length up to 36 hrs would be helpful :grin: Remote learning turned out to be tougher than I expected, and I’m trying to do my best combining both GSoC and passing the semester, which TBH kind of embarrasses me. I’m planning to start serious work on Mypy plugin refactoring as soon as my exam sessions finishes, and I’m aware that I will have a lot of work to catch up with the schedule from my proposal.

At this point there’s not much extra support needed, Mr. Sobolev is really helpful and lends me a hand whenever needed (we’re contacting directly using Telegram). I had no contact with Mr. Malyshev yet, but it’s ok since I’ve heard that he became a father recently (congratz!)

I’m open to any suggestions and would love to hear some reviews on my work, I’d like to know what could be done better.

Best wishes,
Kacper

2 Likes

Hello!

So, just to let you know what’s up as first evaluation approaches:

  • I’ve managed to provide help for user of Django Stubs who create issue #402, basically it turned out that his config file was wrong, so it was pretty simple

  • Mr. Maksim Kurnikov (original author of Django Stubs) stated that he will mentor me for the next few weeks, first task he gave me was to create a proof of concept for merging stubs into Django sources using libcst package, which was kind of successful: PR #408

  • It turned out quickly that finishing this script would take much more time that we expected (due to libcst not working perfectly), so Mr. Kurnikov decided to finish the script by himself, and instructed me to move on to the merits of my proposa. I’ve spent this weekend on getting familiar with the actual code of the plugin and getting some deeper understanding on how the whole thing works (which is great I think), and wait for further instructions from Mr. Kurnikov (he stated to create an issue on this topic with good and comprehensive description in no time).

My exam session is going pretty good (well, let’s say there are ups and downs), and I’m taking the last exam on 9’th of July (finally I know the exact date, yay!). It was a bit hard for me to focus on my GSoC work recently, as last two weeks were extremely stressful for me (unfortunately I can’t handle stress very well), but I keep pushing and doing my best to move on.

I’d like to ask you, especially @carltongibson for some early feedback. I hope that mentors believe that I’ll manage to finish my project successfully and approaching first evaluation will be positive :smiley:

Kindest regards,
Kacper

Hi @kszmigiel. Thanks for your effort: it all looks like you’ve got off to a super start. School takes priority–that’s 100% OK! :slightly_smiling_face:

I hope that mentors believe that I’ll manage to finish my project successfully …

For me, all I’d say is to update the outline from your original plan, adjust scope as you know more now, and set new timings that make sense from here. That gives a framework for discussion, and helps orientate others, like me say :stuck_out_tongue_closed_eyes:, when we’re looking at what you’re working on.

@sobolevn: I’m assuming you’ll complete the evaluation (it’s not very arduous: it only takes 5 mins) — Is that OK?

Thanks both. C.

Evaluation is done! Thanks eveyone!

Glad to be a part of this project :slight_smile:

2 Likes

@carltongibson @sobolevn

Hello!

As the second evaluation is approaching I want to give you a quick overview on what has been done recently in my project.

So, the first good news is that I’ve managed to pass my exams :tada:

The second one is that I’ve managed to sink into the actual plugin code and
I’ve made a lot of progress both in working on the plugin and understanding Mypy.

I started my work basing on Mr. Kurnikov’s branch where he started the refactor a few months ago. Here you can check my PR: https://github.com/typeddjango/django-stubs/pull/427

I’ve managed to make it work almost just like the current master branch version, but now the code is much less like spaghetti :grin: There’s only one bug which I did not manage to get rid of so far, but I hope it’s just a matter of time. Mr. Kurnikov said that we’ll be ready to merge then and probably proceed to other issues mentioned in my proposal. I’ve also started to use time tracking app and send reports to my mentors every week.

In the meantime I’ve also managed to fix one issue reported by user, but that was quick: https://github.com/typeddjango/django-stubs/issues/423

The only problem I currently have is connected with Mr. Sobolev and Mr. Kurnikov’s availability. I can always ask them for advice/code review, but they seem like to have not much time for actual coding/debugging (understandably, everyone has to work). If there’s any other mentor has some free time and would like to get involved in my GSoC project - everyone is welcome.

Kindest regards,
Kacper

1 Like

Hi @kszmigiel. Thanks for the update: good stuff.

@sobolevn: 2nd evaluation time: are you OK to do that?

Let me see if I can swing by to take a look. (3.1 this week so, give me a few days… :slightly_smiling_face:)

1 Like

I posted to the mailing list to ask if anyone has extra capacity to review.
https://groups.google.com/d/topic/django-developers/srd6o02Z01I/discussion

1 Like

The second evaluation is done from my side!

Considering my availability, yes I am currently working on two full-time jobs:

So, @kszmigiel is completely right. I don’t have that much time to actually write some code for django-stubs right now. But, I am here for both reviews and any direct help I can provide.

About my feedback on @kszmigiel 's job: I think he is going great. The code I see is good, the understading of how mypy works is growing everyday.

The only improvement in the process I can possibly think of is some possible issue-triaging (if you have the time of course). There are lot’s of small bugs in typings, that can be solved with little effort.

Happy to work with you! :+1:

3 Likes

Hello guys!

I’ve summed up my whole GSoC participation as an issue in Django Stubs repo. Please take a look and give me some feedback before I submit it to Google.

Here’s the link: https://github.com/typeddjango/django-stubs/issues/450

Kindest regards,
Kacper Szmigiel

2 Likes

Final review time. :slight_smile:

@sobolevn — You OK to do @kszmigiel’s?

Yes, my review is finished and sent!

I want to say “Thank you” to everyone involved.
To Kacper for working hard and helping us improve django-stubs.
To Maxim Kurnikov for helping me with the mentoring and technical process.
To Carlton for being a great mentor and being very helpful.
To DSF for letting us work on this project.

This was a great experience! :+1:t2:

There are now three of us in TypedDjango:

2 Likes

Thanks @sobolevn. :blush:

This has been a good trial including projects outside Django itself in GSoC — I think it’s something we need to do again.