mako icon indicating copy to clipboard operation
mako copied to clipboard

Is mako usable in asynchronous environments?

Open jeremylowery opened this issue 9 months ago • 1 comments

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?

jeremylowery avatar Mar 25 '25 21:03 jeremylowery

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.

zzzeek avatar Mar 26 '25 12:03 zzzeek