Coverage for src/ramses_cli/debug.py: 42%

1#!/usr/bin/env python3

2"""A CLI for the ramses_rf library."""

3

4 from __future__ import annotations

5

6 SZ_DBG_MODE = "debug_mode"

7 DEBUG_ADDR = "0.0.0.0"

8 DEBUG_PORT = 5678

9

10

11 def start_debugging(wait_for_client: bool) -> None:

12 import debugpy

13

14 debugpy.listen(address=(DEBUG_ADDR, DEBUG_PORT))

15 print(f" - Debugging is enabled, listening on: {DEBUG_ADDR}:{DEBUG_PORT}")

16

17 if wait_for_client:

18 print(" - execution paused, waiting for debugger to attach...")

19 debugpy.wait_for_client()

20 print(" - debugger is now attached, continuing execution.")