mako
mako copied to clipboard
Is mako usable in asynchronous environments?
I don't see any documentation regarding asynchronous behavior in the mako documentation. I would guess that the compilation of templates to python code would have a lot of blocking calls, but besides that would there be any other big problems trying to use it in a framework like..FastAPI?
so as long as your mako templates dont do network IO as they execute (which would include things like database access through ORMs), there's no particular limitation for the asyncio context. The compilation phase is cached if Mako is configured appropriately and is still a fairly fast operation in any case.