refactor: fix some imports

This commit is contained in:
Vlad Stan
2026-07-09 16:36:10 +03:00
parent 220be5cc0b
commit 36958d34f0
2 changed files with 4 additions and 9 deletions
+2 -8
View File
@@ -3,6 +3,8 @@ from __future__ import annotations
from functools import lru_cache
from typing import Any
from wasmtime import Config, Engine
from .loader import WasmExtension
@@ -12,14 +14,6 @@ def warm_wasm_extension(extension: WasmExtension) -> None:
@lru_cache(maxsize=1)
def _wasm_engine() -> Any:
try:
from wasmtime import Config, Engine
except ImportError as exc:
raise RuntimeError(
"WASM extension runtime is not installed. Install the 'wasmtime' "
"Python package to run WASM extensions."
) from exc
config = Config()
config.wasm_component_model = True
return Engine(config)
+2 -1
View File
@@ -5,6 +5,8 @@ import re
from collections.abc import Mapping
from typing import Any
from wasmtime import component
from ..api.models import EmptyRequest
from ..api.registry import list_extension_api_methods
from ..api.runtime import ExtensionAPIHost
@@ -73,7 +75,6 @@ def _component_payload_to_dict(value: Any) -> dict[str, Any]:
def _dict_to_component_record(value: Mapping[str, Any]) -> Any:
from wasmtime import component
record = component.Record()
for key, item in value.items():