in blog | Matthias Kestenholz: Posts about Django |
---|---|
original entry | Weeknotes (2023 week 33) |
I’m not sure if I should call these posts weeknotes when I see the posting schedule, but oh well. Keep expectations up but also practice forgiveness when not meeting them, it’s fine really.
py_modules
using hatchlingI converted speckenv and django-sitemaps after finding the following very helpful post on packaging projects consisting of Python modules without any packages: Packaging of single Python module projects with Hatch/Hatchling. It’s very easy in hindsight, but that’s basically always the case.
The relevant part is including the files in the build:
[tool.hatch.build]
include = [
"speckenv.py",
"speckenv_django.py",
"speckenv_django_patch.py",
]
That’s all.
I have also started investigating what would have to be changed in django-debug-toolbar to make it fully support async Django. We currently patch Django’s database cursors per thread, which works fine in sync Django land to attribute SQL queries to a particular request/response cycle.
Since async Django executes DB queries in a thread pool executor and the rest of the work happens inside awaitables (async land) I don’t immediately see a way how we could do the same thing. It doesn’t seem possible to find out which task spawned another task (without dropping down to C?) but maybe there’s something I’m overlooking. I hope that someone smarter than me finds a way :-) or that I find the time and motivation to either find a way using Python or using C/Rust/whatever.
i18n_patterns
when using feincms3-sites with its default_language_middleware
(which allows setting a default language per site in case there is no other mechanism overriding it, such as i18n_patterns
).