When I wrote the post, Paulus hadn’t explained what the main objection is yet. There were various points across all the different conversations on prior pull requests. If I understand Paulus correctly, then the main objection is that using the particular implementation in the pull request would lead to blocking file IO on the event loop, which is an obvious issue for people familiar with how event loops work.
As far as I understand Paulus, making async file IO from within rendering templates however is also not possible.
That said, I do think there’s a third option that doesn’t seem unreasonable. The macro files could be loaded together with the other configuration during startup, cached and provided to Jinja in the form of a “CachedLoader” (which internally just maps filenames to contents).
I’m not sure I have enough understanding of Home Assistant’s architecture to comment or debate on if this should be an integration loaded prior to templates or not. It’s also not clear to me how that in itself would address or fix the issue of async file IO during template rendering and I assume that you suggesting means that it is possible to hook into the template system from within an integration to provide the include / import loader implementation to the template system?
Sadly the Github pull request conversation was locked by a bot before I got the opportunity to respond. I’m following up on the Discord server to see if the conversation can be unlocked again or what the preferred medium is to continue the discussion. I do think there are possible options to get this implemented without breaking Home Assistant.