1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Add an in-memory-preloading loader for Jinja imports (#88850)

* Adds a loader to enable jinja imports.

* Switch to in-memory

* Move loading custom_jinja off of the event loop

* Raise TemplateNotFound if template doesn't exist

* Fix docstring

* Adds a service to reload custom jinja

* Remove IO from test setup

* Improve coverage and small refactor

* Incorporate feedback and use .jinja extension

* Check the loaded sources in test.

* Incorporate PR feedback.

* Update homeassistant/helpers/template.py

Co-authored-by: Erik Montnemery <erik@montnemery.com>

---------

Co-authored-by: Erik Montnemery <erik@montnemery.com>
This commit is contained in:
David Poll
2023-03-13 03:00:05 -07:00
committed by GitHub
parent 5c4f93fa36
commit 7284af6a3e
8 changed files with 178 additions and 6 deletions

View File

@@ -31,6 +31,7 @@ from .helpers import (
entity_registry,
issue_registry,
recorder,
template,
)
from .helpers.dispatcher import async_dispatcher_send
from .helpers.typing import ConfigType
@@ -244,6 +245,7 @@ async def load_registries(hass: core.HomeAssistant) -> None:
entity_registry.async_load(hass),
issue_registry.async_load(hass),
hass.async_add_executor_job(_cache_uname_processor),
template.async_load_custom_jinja(hass),
)