From fb173908db93bea0bd8fab2a97ea1c0a61ded66e Mon Sep 17 00:00:00 2001 From: Masen Furer Date: Thu, 6 Jun 2024 21:31:17 -0700 Subject: [PATCH] Only run `pyi_generator` on files in reflex/components or reflex/__init__.py (#3452) --- scripts/make_pyi.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/scripts/make_pyi.py b/scripts/make_pyi.py index 61773b4ab..82eaddcee 100644 --- a/scripts/make_pyi.py +++ b/scripts/make_pyi.py @@ -12,6 +12,7 @@ logger = logging.getLogger("pyi_generator") LAST_RUN_COMMIT_SHA_FILE = Path(".pyi_generator_last_run").resolve() GENERATOR_FILE = Path(__file__).resolve() GENERATOR_DIFF_FILE = Path(".pyi_generator_diff").resolve() +DEFAULT_TARGETS = ["reflex/components", "reflex/__init__.py"] def _git_diff(args: list[str]) -> str: @@ -92,8 +93,16 @@ if __name__ == "__main__": targets = ( [arg for arg in sys.argv[1:] if not arg.startswith("tests")] if len(sys.argv) > 1 - else ["reflex/components", "reflex/__init__.py"] + else DEFAULT_TARGETS ) + + # Only include targets that have a prefix in the default target list + targets = [ + target + for target in targets + if any(str(target).startswith(prefix) for prefix in DEFAULT_TARGETS) + ] + logger.info(f"Running .pyi generator for {targets}") changed_files = _get_changed_files()