Revisiting types in Django / DEP-14

As a user I’d really like types. I’d especially like types that work fully with pyright as it works without plugins and doesn’t need to run any code, and I find it a better piece of software than mypy in particular. However, django-stubs has only recently began supporting anything other than mypy and the level of support since then has been quite lacking IMO.

As a contributor though, it’s quite scary. A lot of typing syntax (necessarily, because of the theory that goes into it) is complex. Now I need to understand covariance, invariance, and contra-variance, which, even with a CS background, I don’t. No doubt I could learn it, but it’s yet another thing I need to keep in my head when writing a feature or maintaining some code somewhere.

Sure, it’d be great to have. I just don’t know if the benefits outweigh the costs. If Django was a new project, I think it would have types. However, it isn’t, and there are a lot of very dynamic parts that in my understanding require some advanced techniques to type correctly.

I wouldn’t stand in the way of it, but I’m also not in any rush to have it.

2 Likes