From 6dd5f2780e7300ba83197b025afc26c2581aa1a3 Mon Sep 17 00:00:00 2001 From: Jacob Windsor Date: Wed, 19 Feb 2025 16:40:13 +0100 Subject: [PATCH] Allow for debugging --- .gitignore | 3 ++- .vscode/extensions.json | 10 ++++++++++ .vscode/launch.json | 25 +++++++++++++++++++++++++ .vscode/settings.json | 9 ++++++--- .vscode/tasks.json | 17 +++++++++++++++++ Makefile | 3 +++ backend/requirements.txt | 1 + 7 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index d6dc777..475a549 100644 --- a/.gitignore +++ b/.gitignore @@ -173,4 +173,5 @@ cython_debug/ # PyPI configuration file .pypirc -venv \ No newline at end of file +venv +.ruff_cache \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 0000000..9bbadfa --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,10 @@ + + +{ + "recommendations": [ + "charliermarsh.ruff", + "ms-python.python", + "ckolkman.vscode-postgres", + "ms-vscode.makefile-tools", + ] +} diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..e9a0ffa --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,25 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug: Backend", + "type": "debugpy", + "request": "launch", + "module": "uvicorn", + "cwd": "${workspaceFolder}/backend", + "args": [ + "app.main:app", + "--reload", + "--reload-include", + "backend/src", + "--port", + "8080" + ], + "jinja": true, + "justMyCode": false, + "consoleName": "Backend", + "preLaunchTask": "Start DB", + "python": "${workspaceFolder}/venv/bin/python", + }, + ] +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ec1907..e9c0073 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,11 @@ { - "python.defaultInterpreterPath": ".venv/bin/python", + "python.defaultInterpreterPath": "venv/bin/python", "editor.formatOnSave": true, "[python]": { - "editor.defaultFormatter": "ms-python.python", - "editor.formatOnSave": true, + "editor.defaultFormatter": "charliermarsh.ruff", + "editor.codeActionsOnSave": { + "source.fixAll": "explicit", + "source.organizeImports": "explicit" + } }, } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..29df3df --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,17 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Start All", + "type": "shell", + "command": "docker compose up -d", + "problemMatcher": [] + }, + { + "label": "Start DB", + "type": "shell", + "command": "docker compose up -d db", + "problemMatcher": [] + }, + ] +} \ No newline at end of file diff --git a/Makefile b/Makefile index 23bf884..6db9358 100644 --- a/Makefile +++ b/Makefile @@ -19,3 +19,6 @@ start: clean: rm -rf $(VENV_DIR) +clean-db: + docker compose down -v db + diff --git a/backend/requirements.txt b/backend/requirements.txt index fc946e7..b137471 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -7,3 +7,4 @@ pydantic-settings python-dotenv pg8000 asyncpg +greenlet