Hacker News new | ask | show | jobs
by KolmogorovComp 3 days ago
Why anyone would still use mypy besides legacy infrastructure is beyond me. It is dog slow as well as being the laziest of all, not catching many mistakes.

Unfortunately for Django apps switching to any alternative leads to the dreaded “wall of errors” issue. If anyone got to work this out in the past, I’d gladly take advices.

2 comments

I use pyright with a 50k LOC Django REST API codebase. I haven't really had problems. From my pyproject.toml:

django==4.2.30

djangorestframework==3.16.1

---

django-types==0.15.0

djangorestframework-types==0.8.0

pyright==1.1.390

My dj version is pretty old, but I'd assume things have only gotten better since v 4?

The django mypy plugin can inspect django models types, project settings and much more context.
We switched our very large Django monolith codebase over to ty — the trick for us was generating stubs for Django models and having tooling keep those stubs in sync with the actual models.

Went from type checking taking ~10 minutes in CI to now taking ~15 seconds and runs on pre-commit.

Absolute game changer, I think we spent $10k in claude credits and did the entire mypy -> ty refactor in about 3 weeks.