@anze3db wins the prize for first blog mention of Django Mantle 🚀

https://blog.pecar.me/typing-your-django-project-in-2026/ #Django #Mantle

Typing Your Django Project in 2026

The first version of Django was released about 10 years before Python standardized its type hints syntax. Because of this it’s not surprising that getting type hints to work in your Django project is not going to be trivial. django-stubs with mypy If you want your Django codebase to be type checked then django-stubs is the go to package to use. It ships both type-stubs for most of Django’s public APIs as well as a mypy plugin that fills in the typing information for all the dynamic black magic that we love Django for. You’ll also want to include the monkeypatch from django-stubs-ext for best results.

AnĹže's Blog

@anze3db I gave a talk about this at the JetBrains PyTV event recently. It goes into more of the motivation:

https://www.youtube.com/watch?v=qKkyBhXIJJU&t=10591s

(Timestamp in link, in case the preview loses it)

Python Unplugged on PyTV – Free Online Python Conference

YouTube
@carlton cool talk, thanks for the link! I've also added it to the blog post.
@anze3db Thanks, let me know if you have any feedback!

@carlton On the by, I forgot to mention that I caught your presentation on PyTV a couple of weeks ago and I forgot to comment.

I haven't had a chance to play with it yet, but I was very happy to see this! I've done some work on an old Django monolith that has business logic ALL OVER THE PLACE, but it bugs me the most when I find it embedded in the models themselves.

I also like the separation of concerns on the edges, where you can control serialization (and take advantage of type hints!) and resulting business logic, without bothering the models themselves.

I really enjoyed Hynek's @hynek Design Pressure talk at last year's PyCon US, and really appreciate this effort.

Not sure when I'll have time to use it heavily, but I'll certainly reach for it if/when I start my next Django project!

Hey @pythonbynight, thanks for watching: glad you enjoyed it! 😊

Mantle is pretty lightweight, so don’t be shy about giving it a run on a (single view of an) existing project (if you’ve got one) 😜

1/2

@pythonbynight Since you mentioned @hynek, his talk at PyConUK talked about “graduality” (not sure that was the exact word) — the approach is all about smoothing the complexity curve as you outgrow (or hit the problems with) the active record pattern. It’s my take on how we separate the db mapping layer, which the ORM is lovely for, from our application logic, which often doesn’t map to individual db tables.

Anyhow, if you do have a play let me know how you get on!