If Django can now also support annotations and async code I dream of an scenario where apis can be built using this two elements.
Does anybody know a good resource to learn/catch up with this release?
If Django can now also support annotations and async code I dream of an scenario where apis can be built using this two elements.
Does anybody know a good resource to learn/catch up with this release?
If I am willing to hack a bit, is it possible?
What is the main obstacle? Is it all middleware?
middleware is a part of it, then there's the ORM, caching and anything else that does IO.
Another option is using something like Tom Christie's orm project (https://github.com/encode/orm), which is a wrapper on top of sqlachemy with a django like interface.
Also, thank you and all the contributors for such amazing resource.
Am I correct to understand this as meaning async views can’t even read from the database yet? I guess the only use cases for ASGI views currently would be interacting with outside-Django backends that implement async support and such?
[0] https://pyotr.readthedocs.io
In a way it feels kinda lispy (in a good way) to me, data is code, small DSL for working more efficiently with specific domain.
There’s a couple reasons:
1. you get a breakdown of all the new features, which only takes a few minutes to kind of quickly go through each version and decide which bits you care about
2. you get a list of backwards-incompatible changes, which resolves any upgrade regressions, as long as you’re not using internal APIs that have changed
(Partly inspired by FastAPI)
Coupled with Pydantic for validation it really does make things easy :D
1. Performance, it's a wrapper on top of starlette/uvicorn, which brings the performance closer to nodejs (https://www.techempower.com/benchmarks/#section=data-r17&hw=...). (I did run into some issues with it though due to the default response validation when serializing large response bodies)
2. Lightweight background tasks (from starlette)
3. Documentation generation from type annotations.
It's a nice tool for microservices but coming from django you'll have to roll your own database management, authentication, sessions, caching, admin and etc. I'm also not a fan of the magic request unpacking using type annotations and prefer getting a request object as is done in django and starlette. IMHO most people would probably be better off with plain starlette and a 3 line decorator to handle request validation and response serialization.
Why do you think plain starlette is better? Are the type annotations annoying to debug?
I was trying it out for a machine learning service that had to send back large dense vectors and I hit some other performance issues (like https://github.com/tiangolo/fastapi/issues/360#issuecomment-...), due to the coupling of validation with serialization.