perf: lazy-import in CLI commands to speed up startup (#335)

This commit is contained in:
d3vyce
2026-07-02 22:40:48 +02:00
committed by GitHub
parent fe2c0f3eff
commit 44ba5bdd4b
3 changed files with 23 additions and 5 deletions
+2 -1
View File
@@ -1,6 +1,5 @@
"""CLI utility functions."""
import asyncio
import functools
from collections.abc import Callable, Coroutine
from typing import Any, ParamSpec, TypeVar
@@ -24,6 +23,8 @@ def async_command(func: Callable[P, Coroutine[Any, Any, T]]) -> Callable[P, T]:
@functools.wraps(func)
def wrapper(*args: P.args, **kwargs: P.kwargs) -> T:
import asyncio
return asyncio.run(func(*args, **kwargs))
return wrapper