From d520b34762502e4d1a2f3454f5b8afd3b5fbb6de Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Mon, 13 May 2024 15:37:34 -0700 Subject: [PATCH] Only import PyiGenerator when needed (#3291) Speed up reflex invocation time for `--help` by 1s --- reflex/custom_components/custom_components.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/reflex/custom_components/custom_components.py b/reflex/custom_components/custom_components.py index 79ab26d93..ec35fb5c4 100644 --- a/reflex/custom_components/custom_components.py +++ b/reflex/custom_components/custom_components.py @@ -20,7 +20,6 @@ from reflex import constants from reflex.config import get_config from reflex.constants import CustomComponents from reflex.utils import console -from reflex.utils.pyi_generator import PyiGenerator config = get_config() custom_components_cli = typer.Typer() @@ -438,6 +437,8 @@ def _run_commands_in_subprocess(cmds: list[str]) -> bool: def _make_pyi_files(): """Create pyi files for the custom component.""" + from reflex.utils.pyi_generator import PyiGenerator + package_name = _get_package_config()["project"]["name"] for dir, _, _ in os.walk(f"./{package_name}"):