typeddjango / django-stubs

PEP-484 stubs for Django
MIT License
1.62k stars 452 forks source link

Django Google Summer of Code 2024 #2012

Open adamchainz opened 8 months ago

adamchainz commented 8 months ago

Like last year (#1337), Django is doing GSoC again and django-stubs is on the list of potential projects.

It actually remained there because it was just copied from last year’s wiki page, with two projects that I think are now irrelevant:

  1. Mypy strict-mode support - the stubs should be mostly(?) strict-mode compatible since #1556.
  2. Merging django-types back in - somewhat covered by supporting other checkers in #1628, and hard to merge further due to continued drift.

So I just deleted those projects from the wiki page and added a generic one, Expand django-stubs coverage, which would cover any proposal for clearing some of the entries from the stubtest TODO files.

Other maintainers and regular contributors, do you think this is okay? Would you be willing to mentor, and do you have any other possible projects?

nebiyuelias1 commented 8 months ago

@adamchainz thank you very much for creating this issue (I was the one who got interested in those project ideas from last year). I was wondering how you produced the allowlist_todo.txt and allowlist_todo_django50.txt files.

adamchainz commented 8 months ago

They are produced by the stubtest tool. Read the relevant part of the contributing guide and try run it yourself locally.

sobolevn commented 8 months ago

I won't participate in GSoC ever again: https://developers.google.com/open-source/gsoc/faq?hl=en#are_participants_from_ukraine_russia_or_belarus_allowed_to_participate_in_gsoc_2024

But, I have no problem with other contributors / maintainers participating :)

nebiyuelias1 commented 8 months ago

Can anyone please explain to me why the stubtest reports a lot of errors when I run it locally whereas the github action seems to be showing green(all went well I suppose)? I was also wondering why the the number of errors decreases when I remove an entry from the allowlist_todo.txt file? I was expecting the opposite.

sobolevn commented 8 months ago

It depends on how you install your stub package (see https://github.com/typeddjango/django-stubs/blob/f92821a3f55f95854a1b1802d5077ced9b5d205d/.github/workflows/test.yml#L34) and how you set your MYPYPATH (see https://github.com/typeddjango/django-stubs/blob/f92821a3f55f95854a1b1802d5077ced9b5d205d/scripts/stubtest.sh#L7)

Does it help? Feel free to send a PR with fixes to CONTRIBUTING.md :)

nebiyuelias1 commented 8 months ago

@sobolevn After creating a git ignored venv, I used the same command as in django-stubs/.github/workflows/test.yml to install the requirements. I'm not sure what's the correct value for MYPYPATH env variable (I didn't modify it). Could it be because of my python version? I'm using 3.10.

intgr commented 8 months ago

You're probably experiencing a common stubtest issue with caching. Try deleting .mypy_cache between stubtest runs.

btw: this issue isn't a good place for discussing such specific problems -- but we don't really have a good place. Maybe we should reconsider opening GitHub Discussions for the project.

nebiyuelias1 commented 8 months ago

Oh so sorry, for spamming and abusing this issue! It's just because I'm new to this repo.

jorenham commented 8 months ago

What are your thoughts on putting pyright compatiblity in there as one of the main goals?

sobolevn commented 8 months ago

@jorenham this is a good project, yes! You would need to find some other mentor among django-stubs maintainers, though :)

Viicos commented 8 months ago

This also relates to https://github.com/sbdchd/django-types/issues/207, I'll try to find some time working on this in the next couple weeks. I'll be attending DjangoCon Europe in June as well, maybe I'll find some time to work on it there