News for hackers. Stuff that matters.
Re:Astral – "We're building a new static type checker for Py... by ehutch79 on Wednesday January 29, 2025 @03:47PM (#42870954)
My big question is django support.

Django has a lot of magic that makes type checking more difficult than it should be.

I'm not really expecting anything, even just the speed bump will be nice.

Re:Astral – "We're building a new static type checker for Py... by claytonjy on Wednesday January 29, 2025 @03:53PM (#42871017)
is Django working towards using native types instead of all they stuff they invented before type hints existed?
Re:Astral – "We're building a new static type checker for Py... by rtpg on Wednesday January 29, 2025 @04:00PM (#42871093)
I am not part of the DSF or anything but I can say with a good amount of confidence that the answer to this is “No”.

Moving to a Pydantic-style model would be a whole different ballgame. Hell of a lot of work, and meanwhile we can’t even really get to “let’s have type hints in some of the Django infernals”.

But! I do think someone who wants to have fun could try to build a type hint based Model subclass as a third party lib! There’s a looooot of stuff to resolve in that world but for any proposal like that the general vibe is “prove the feasibility with a third party package first”.

Re:Astral – "We're building a new static type checker for Py... by c-fe on Wednesday January 29, 2025 @04:31PM (#42871450)
I think there is potential for a new python web framework with batteries included (like django) but using newer paradigms (typing, …). Fastapi itself is a nice concept but its a bit of a mess (the main author just keeps closing bug issues and adds somewhat useless things (just check the git commit log)), and also it requires db tooling (sqlalchemy) and other things
Re:Astral – "We're building a new static type checker for Py... by rtpg on Wednesday January 29, 2025 @06:35PM (#42872800)
I kind of agree, though at least Django with type stubs gets me 95% of the way there.

At the end of the day I end up writing a service layer over everything so I'm not super bugged by most of this. But it's busywork when first starting up a project.

Re:Astral – "We're building a new static type checker for Py... by IceWreck on Wednesday January 29, 2025 @04:57PM (#42871756)
You should check out litestar

It's essentially what you described and it's growing in popularity.

Re:Astral – "We're building a new static type checker for Py... by c-fe on Thursday January 30, 2025 @07:31AM (#42877153)
Thanks, ill check it out!
Re:Astral – "We're building a new static type checker for Py... by physicsguy on Thursday January 30, 2025 @10:25AM (#42878608)
It's really nothing like Django, which is a full stack development framework. This is more akin to Django REST Framework or Django Ninja which are REST API frameworks that sit on top of Django.
Re:Astral – "We're building a new static type checker for Py... by physicsguy on Thursday January 30, 2025 @10:24AM (#42878597)
It's also super clunky if you get into certain advanced things because it's built on top of Starlette and piggybacks off much of that. Want to adjust how many background threads you want running? Oh wait, you can't, it's a Starlette setting that's not really exposed.
Re:Astral – "We're building a new static type checker for Py... by physicsguy on Thursday January 30, 2025 @10:23AM (#42878583)
Django's magic is that you can set various class variables as either a value or a method. So typing that becomes incredibly hard, everything is effectively Union typed.
Re:Astral – "We're building a new static type checker for Py... by adsharma on Wednesday January 29, 2025 @05:25PM (#42872058)
Re:Astral – "We're building a new static type checker for Py... by aleksanb on Wednesday January 29, 2025 @07:15PM (#42873173)
Agree with this.

All type checkers other than mypy (e.g. pyright, intellij) have ignored the level of plugin support necessary to make django work well, and so they are DOA for any large existing django codebase. Unless ruff decides to support such a dynamic interface as mypy's, it'll fare no better.

We use mypy with [django-stubs](https://github.com/typeddjango/django-stubs) which works ok nowadays.

There was an effort to create a typechecking plugin interface for dataclass-style transforms for python type checkers, but what was merged was so lacking that one couldn't even make something close to django-stubs with it.

Re:Astral – "We're building a new static type checker for Py... by aitchnyu on Thursday January 30, 2025 @02:01AM (#42875592)
Will django-stubs work with other typecheckers?

Tangential, I'm waiting for Edgedb to become next SQL so all ORM moats like Django's are drained.

https://github.com/typeddjango/django-stubs