Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, to have a properly typed codebase I'm basically isolating the ORM and models from the rest of our app. So there is a selector layer that fetches data, and then maps that do dataclasses/pydantic, instead of passing the django model objects around.

It's a good practice anyways I feel, as the application grows you don't want different "apps" to know too much about models in other apps.

But even with this flow, in my selector layer I still have to do "# type: ignore" any time I've used an annotation. Especially due to python's lacking lambdas, when I map data from a queryset it often has to be a properly defined function, but then whatever annotation django-stubs managed to apply is lost anyways.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: