[+] update debugging

1. disable telemtry in ms-python;
  1.1. TODO, use a forked version of the plugin;
  2. add debug module into pr34;
  3. enable show strack frame for all .py files;
This commit is contained in:
Siarhei Siniak 2024-12-04 19:01:30 +03:00
parent 74cc54ae85
commit 4afe4048d9
5 changed files with 41 additions and 3 deletions

2
.gitignore vendored

@ -10,4 +10,4 @@ d2/book1/books
*.egg-info *.egg-info
*.whl *.whl
*.tar.gz *.tar.gz
.code .vscode

@ -1 +1 @@
Subproject commit 8154ac0b1e575b1e765fa0a561cfbca371de8df0 Subproject commit 1c8f054d29bfa9dae897f6101f95e8eb4f920305

@ -3,5 +3,7 @@
"editor.minimap.autohide": true, "editor.minimap.autohide": true,
"editor.minimap.maxColumn": 80, "editor.minimap.maxColumn": 80,
"editor.minimap.size": "fit", "editor.minimap.size": "fit",
"diffEditor.hideUnchangedRegions.enabled": true "diffEditor.hideUnchangedRegions.enabled": true,
"python.experiments.enabled": false,
"debugpy.debugJustMyCode": false
} }

@ -1625,6 +1625,7 @@ def vpn(argv: list[str]) -> None:
'sudo', 'sudo',
*python_path, *python_path,
'-B', '-B',
'-Xfrozen_modules=off',
'-m', '-m',
'online_fxreader.vpn.vpn', 'online_fxreader.vpn.vpn',
*argv, *argv,

@ -0,0 +1,35 @@
import os
import logging
from typing import (Optional,)
logger = logging.getLogger(__name__)
class DebugPy:
@classmethod
def set_trace(
cls,
host: Optional[str] = None,
port: Optional[int] = None,
wait: Optional[bool] = None,
) -> None:
if host is None:
host = '127.0.0.1'
if port is None:
port = 4444
if wait is None:
wait = True
import debugpy
if os.environ.get('DEBUGPY_RUNNING') != 'true':
logger.info('debugpy init')
import debugpy
debugpy.listen((host, port))
os.environ['DEBUGPY_RUNNING'] = 'true'
if wait:
debugpy.wait_for_client()
debugpy.breakpoint()
logger.info('debugpy done')