diff --git a/codeflash/tracing/tracing_new_process.py b/codeflash/tracing/tracing_new_process.py index fa3ae2f9c..e17ff14e9 100644 --- a/codeflash/tracing/tracing_new_process.py +++ b/codeflash/tracing/tracing_new_process.py @@ -13,6 +13,7 @@ import threading import time from collections import defaultdict +from importlib.util import find_spec from pathlib import Path from typing import TYPE_CHECKING, Any, Callable, ClassVar @@ -47,6 +48,17 @@ def __init__(self, code: FakeCode, prior: FakeFrame | None) -> None: self.f_locals: dict = {} +def patch_ap_scheduler() -> None: + if find_spec("apscheduler"): + import apscheduler.schedulers.background as bg + import apscheduler.schedulers.blocking as bb + from apscheduler.schedulers import base + + bg.BackgroundScheduler.start = lambda _, *_a, **_k: None + bb.BlockingScheduler.start = lambda _, *_a, **_k: None + base.BaseScheduler.add_job = lambda _, *_a, **_k: None + + # Debug this file by simply adding print statements. This file is not meant to be debugged by the debugger. class Tracer: """Use this class as a 'with' context manager to trace a function call. @@ -820,6 +832,7 @@ def runctx(self, cmd: str, global_vars: dict[str, Any], local_vars: dict[str, An if __name__ == "__main__": args_dict = json.loads(sys.argv[-1]) sys.argv = sys.argv[1:-1] + patch_ap_scheduler() if args_dict["module"]: import runpy diff --git a/codeflash/version.py b/codeflash/version.py index 3a496cb4c..bf7c8a1b5 100644 --- a/codeflash/version.py +++ b/codeflash/version.py @@ -1,2 +1,2 @@ # These version placeholders will be replaced by uv-dynamic-versioning during build. -__version__ = "0.17.0" +__version__ = "0.16.7.post46.dev0+444ff121"