diff --git a/reflex/reflex.py b/reflex/reflex.py index f6640679535..50d0659a102 100644 --- a/reflex/reflex.py +++ b/reflex/reflex.py @@ -216,12 +216,9 @@ def _run( *args, **kwargs, ) - validation_result = compile_future.result() + compile_future.result() else: - validation_result = app_task(*args, **kwargs) - - if not validation_result: - raise click.exceptions.Exit(1) + app_task(*args, **kwargs) # Get the frontend and backend commands, based on the environment. setup_frontend = frontend_cmd = backend_cmd = None diff --git a/reflex/utils/prerequisites.py b/reflex/utils/prerequisites.py index bfccc5e9559..856ef16e3ed 100644 --- a/reflex/utils/prerequisites.py +++ b/reflex/utils/prerequisites.py @@ -7,8 +7,6 @@ import functools import importlib import importlib.metadata -import importlib.util -import io import json import os import platform @@ -498,86 +496,25 @@ def compile_app( ) -def _can_colorize() -> bool: - """Check if the output can be colorized. - - Copied from _colorize.can_colorize. - - https://raw.githubusercontent.com/python/cpython/refs/heads/main/Lib/_colorize.py - - Returns: - If the output can be colorized - """ - file = sys.stdout - - if not sys.flags.ignore_environment: - if os.environ.get("PYTHON_COLORS") == "0": - return False - if os.environ.get("PYTHON_COLORS") == "1": - return True - if os.environ.get("NO_COLOR"): - return False - if os.environ.get("FORCE_COLOR"): - return True - if os.environ.get("TERM") == "dumb": - return False - - if not hasattr(file, "fileno"): - return False - - if sys.platform == "win32": - try: - import nt - - if not nt._supports_virtual_terminal(): - return False - except (ImportError, AttributeError): - return False - - try: - return os.isatty(file.fileno()) - except io.UnsupportedOperation: - return file.isatty() - - def compile_or_validate_app( compile: bool = False, check_if_schema_up_to_date: bool = False, prerender_routes: bool = False, -) -> bool: +): """Compile or validate the app module based on the default config. Args: compile: Whether to compile the app. check_if_schema_up_to_date: If True, check if the schema is up to date. prerender_routes: Whether to prerender routes. - - Returns: - If the app is compiled successfully. """ - try: - if compile: - compile_app( - check_if_schema_up_to_date=check_if_schema_up_to_date, - prerender_routes=prerender_routes, - ) - else: - validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date) - except Exception as e: - if isinstance(e, click.exceptions.Exit): - return False - - import traceback - - sys_exception = sys.exception() - - try: - colorize = _can_colorize() - traceback.print_exception(e, colorize=colorize) # pyright: ignore[reportCallIssue] - except Exception: - traceback.print_exception(sys_exception) - return False - return True + if compile: + compile_app( + check_if_schema_up_to_date=check_if_schema_up_to_date, + prerender_routes=prerender_routes, + ) + else: + validate_app(check_if_schema_up_to_date=check_if_schema_up_to_date) def get_redis() -> Redis | None: