django-stubs is black magic and helps a lot.
Here's an example setup that I use for my library:
https://github.com/silviogutierrez/reactivated/
the "sample" site is 100% type checked. Look at scripts/test.sh for running mypy in ci (and .github for the CI config)
Ran into a couple issues with the typing of ‘client.force_login()’ where the ‘user’ parameter was typed as the ‘get_django_user()’ which wasn’t the same as the custom user model I defined in the ‘models.py’. I also had issues with ‘from django.conf import settings’ not being the correct type so I’d suggest changing that to ‘Any’.
You might be able to override the few types that don’t work for your given setup or you can just fork the repo.
Overall, I think the pain is worth the benefits.
> I also had issues with ‘from django.conf import settings’ not being the correct type so I’d suggest changing that to ‘Any’.
This one also has plugin support, and should be working mostly correct. Fill the issue if you can reproduce, I'd love to help with that.
What's your experience with that whole "plugin has to actually run django.setup() before typecheck" thing?
1. https://blog.zulip.org/2016/10/13/static-types-in-python-oh-...
Try 'django-stubs' mentioned above too https://github.com/typeddjango/django-stubs, it's mostly complete. Mypy plugin inside takes care of a lot of stuff.
Disclaimer: I'm a creator of the 'django-stubs'