← Back to context

Comment by ducdetronquito

5 days ago

Good job, template partials looks like a nice improvement !

That being said, the current state of type annotations is a pain: django-stubs works on mypy but with a plugin (and mypy is slow as hell), django-types is a fork a django-stubs that works on pyright but is usually out of sync and pylance ships its owned stubs forked from django-types.

My biggest wish for next Django release would be that they finally ship type annotations themselves where it is possible. I don't need the crazy inheritance parts or the crazy stringly typed parts to be have proper type annotations, but just some simple stuff like HttpRequest, HttpResponse, View, Model, etc would help a LOT !

I have the same issues in Zed and VS Code, but somehow everything works in PyCharm. Even all the double underscore nonsense in QuerySets that I've never seen work enywhere else. I don't use it very often because I mostly work from my potato of a laptop these days, but when I really just need to Get Shit Done, I sacrifice 10 browser tabs to reclaim some RAM and open PyCharm.

  • Pycharm does not have good type checking. It has the best type inference, but its type checking is very basic. It’s not strict, that’s why you don’t see a lot of errors. When complex types don’t much, it won’t complain.

I agree, type annotations need work. I just use stubs and then I have some rules to set some of the more common ones to be warnings instead of errors, and then I just deal with the fact that there's gonna be some yellow squiggles.