From 438254c594e48c460274cac0f04a73d9d0743ff1 Mon Sep 17 00:00:00 2001 From: arabcoders Date: Fri, 25 Jul 2025 17:37:52 +0300 Subject: [PATCH] Added task to kill debugpy, sometimes vscode leave it behind causing problems during development --- .vscode/launch.json | 19 +++++++++---------- .vscode/tasks.json | 22 ++++++++++++++++++++++ app/main.py | 1 - 3 files changed, 31 insertions(+), 11 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.vscode/launch.json b/.vscode/launch.json index a0cd2cce..14415dad 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,7 +1,4 @@ { - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { @@ -18,17 +15,17 @@ "cwd": "${workspaceFolder}/ui", "env": { "NUXT_API_URL": "http://localhost:8081/api/", - "NUXT_PUBLIC_WSS": ":8081/", + "NUXT_PUBLIC_WSS": ":8081/" }, "console": "internalConsole", - "outputCapture": "std", + "outputCapture": "std" }, { - "name": "Python: main.py", + "name": "Python: main.py ", "type": "debugpy", "request": "launch", "program": "app/main.py", - "console": "internalConsole", + "console": "integratedTerminal", "justMyCode": true, "env": { "YTP_CONFIG_PATH": "${workspaceFolder}/var/config", @@ -36,7 +33,9 @@ "YTP_TEMP_PATH": "${workspaceFolder}/var/tmp", "PYDEVD_DISABLE_FILE_VALIDATION": "1", "YTP_IGNORE_UI": "true" - } + }, + "subProcess": true, + "postDebugTask": "kill-debugpy" }, { "name": "Node: Generate UI", @@ -65,14 +64,14 @@ "YTP_CONFIG_PATH": "${workspaceFolder}/var/config", "YTP_DOWNLOAD_PATH": "${workspaceFolder}/var/downloads", "YTP_TEMP_PATH": "${workspaceFolder}/var/tmp", - "YTP_LOG_LEVEL": "DEBUG", + "YTP_LOG_LEVEL": "DEBUG" } }, { "name": "Python: Attach To Process", "type": "debugpy", "request": "attach", - "processId": "${command:pickProcess}", + "processId": "${command:pickProcess}" }, { "name": "Python: Attach To Container", diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..ee6cc98f --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,22 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "kill-debugpy", + "type": "shell", + "command": "pkill -f debugpy || true", + "problemMatcher": [], + "presentation": { + "echo": false, + "reveal": "never", + "focus": false, + "panel": "dedicated", + "showReuseMessage": false, + "clear": false + }, + "runOptions": { + "runOn": "folderOpen" + } + } + ] +} diff --git a/app/main.py b/app/main.py index bcda05d8..549ace11 100644 --- a/app/main.py +++ b/app/main.py @@ -171,7 +171,6 @@ class Main: self._app, host=host, port=port, - reuse_port="win32" != sys.platform, loop=asyncio.get_event_loop(), access_log=HTTP_LOGGER, print=started,