From aa337caf609a36ed4138c1bb3c0fbab183d2dfa6 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Wed, 28 Feb 2024 11:12:49 +0000 Subject: [PATCH 1/9] simplify dev container setup --- .devcontainer.json | 89 ++++++++++++++++++++++++++++++++++++++ backend/Pipfile | 28 +++++++++--- backend/pyproject.toml | 1 + codeforlife.code-workspace | 12 +++++ 4 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 .devcontainer.json create mode 100644 codeforlife.code-workspace diff --git a/.devcontainer.json b/.devcontainer.json new file mode 100644 index 00000000..a169a66e --- /dev/null +++ b/.devcontainer.json @@ -0,0 +1,89 @@ +{ + "name": "portal-react", + "dockerComposeFile": [ + "../docker-compose.yml" + ], + "service": "base-service", + "shutdownAction": "none", + "workspaceFolder": "/workspace/codeforlife-portal-react", + "mounts": [ + "source=./codeforlife-package-python,target=/workspace/codeforlife-package-python,type=bind,consistency=cached" + ], + "remoteUser": "root", + "postCreateCommand": "./setup", + "features": { + "ghcr.io/devcontainers/features/python:1": { + "version": "3.8", + "installTools": false + }, + "ghcr.io/devcontainers-contrib/features/pipenv:2": { + "version": "2023.11.15" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "18" + } + }, + "customizations": { + "vscode": { + //TODO: Specify preferred settings and extensions once defined + "settings": { + "python.analysis.extraPaths": [ + "../codeforlife-package-python" + ], + "python.defaultInterpreterPath": "backend/.venv/bin/python", + "autoDocstring.customTemplatePath": ".vscode/extensions/autoDocstring/docstring.mustache", + "files.exclude": { + "**/__pycache__": true, + "**/.pytest_cache": true, + "**/.mypy_cache": true, + "**/.hypothesis": true + }, + "editor.tabSize": 2, + "editor.rulers": [ + 80 + ], + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "workbench.colorCustomizations": { + "editorRuler.foreground": "#008000" + }, + "[md]": { + "editor.tabSize": 4 + }, + "[python]": { + "editor.tabSize": 4, + "editor.defaultFormatter": "ms-python.black-formatter", + }, + "cSpell.words": [ + "codeforlife", + "klass", + "ocado", + "kurono", + "pipenv" + ] + }, + "extensions": [ + "github.vscode-pull-request-github", + "redhat.vscode-yaml", + "davidanson.vscode-markdownlint", + "bierner.markdown-mermaid", + "ms-python.python", + "ms-python.pylint", + "ms-python.isort", + "ms-python.vscode-pylance", + "ms-python.mypy-type-checker", + "ms-python.black-formatter", + "streetsidesoftware.code-spell-checker", + "tamasfe.even-better-toml", + "kevinrose.vsc-python-indent", + "batisteo.vscode-django", + "njpwerner.autodocstring", + "visualstudioexptteam.vscodeintellicode", + "wholroyd.jinja", + "qwtel.sqlite-viewer" + ] + } + } +} \ No newline at end of file diff --git a/backend/Pipfile b/backend/Pipfile index 8cfa0241..e123a847 100644 --- a/backend/Pipfile +++ b/backend/Pipfile @@ -3,11 +3,28 @@ url = "https://pypi.org/simple" verify_ssl = true name = "pypi" +## ℹ️ HOW-TO: Make the python-package editable. +# +# 1. Comment out the git-codeforlife package under [packages]. +# 2. Comment out the git-codeforlife package under [dev-packages]. +# 3. Uncomment the editable-codeforlife package under [dev-packages]. +# 4. Run `pipenv install --dev` in your terminal. +# +# ⚠️ Make sure you revert these changes before pushing your changes or the +# pipeline will fail to install the python-package. +# +## ℹ️ HOW-TO: Install a new version of the python-package. +# +# 1. Uncomment the git-codeforlife package under [packages]. +# 2. Uncomment the git-codeforlife package under [dev-packages]. +# 3. Comment out the editable-codeforlife package under [dev-packages]. +# 4. Set the ref key of the git-codeforlife packages under [packages] and +# [dev-packages] to have the same version number. +# 5. Run `pipenv install --dev` in your terminal. + [packages] -# Before adding a new package, check it's not listed under [packages] at -# https://github.com/ocadotechnology/codeforlife-package-python/blob/{ref}/Pipfile -# Replace "{ref}" in the above URL with the ref set below. codeforlife = {ref = "v0.14.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"} +# 🚫 Don't add [packages] below that are inhertited from the CFL package. # TODO: check if we need the below packages whitenoise = "==6.5.0" django-pipeline = "==2.0.8" @@ -31,10 +48,9 @@ google-cloud-container = "==2.3.0" # "django-anymail[amazon_ses]" = "==7.0.*" [dev-packages] -# Before adding a new package, check it's not listed under [dev-packages] at -# https://github.com/ocadotechnology/codeforlife-package-python/blob/{ref}/Pipfile -# Replace "{ref}" in the above URL with the ref set below. codeforlife = {ref = "v0.14.0", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]} +# codeforlife = {file = "../../codeforlife-package-python", editable = true, extras = ["dev"]} +# 🚫 Don't add [dev-packages] below that are inhertited from the CFL package. # TODO: check if we need the below packages django-selenium-clean = "==0.3.3" django-test-migrations = "==1.2.0" diff --git a/backend/pyproject.toml b/backend/pyproject.toml index 73d5c6ca..54059f01 100644 --- a/backend/pyproject.toml +++ b/backend/pyproject.toml @@ -12,6 +12,7 @@ env = [ [tool.mypy] plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main"] check_untyped_defs = true +mypy_path = "../../codeforlife-package-python" [tool.django-stubs] django_settings_module = "service.settings" diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace new file mode 100644 index 00000000..fdf7f9eb --- /dev/null +++ b/codeforlife.code-workspace @@ -0,0 +1,12 @@ +{ + "folders": [ + { + "path": ".", + "name": "portal-react" + }, + { + "path": "../codeforlife-package-python", + "name": "package-python" + } + ] +} \ No newline at end of file From 419113b203bd3dd93cf15abdd9deb3d044b84f80 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Sun, 3 Mar 2024 21:51:07 +0000 Subject: [PATCH 2/9] synced with submodule configs --- .devcontainer.json | 184 +++++++++++------- ...ode-snippets => codeforlife.code-snippets} | 62 +++--- .vscode/extensions.json | 13 -- .vscode/launch.json | 55 +++--- .vscode/settings.json | 47 ----- .vscode/tasks.json | 71 ++++--- codeforlife.code-workspace | 8 +- 7 files changed, 210 insertions(+), 230 deletions(-) rename .vscode/{workspace.code-snippets => codeforlife.code-snippets} (71%) delete mode 100644 .vscode/extensions.json delete mode 100644 .vscode/settings.json diff --git a/.devcontainer.json b/.devcontainer.json index a169a66e..48c73650 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,89 +1,131 @@ { - "name": "portal-react", - "dockerComposeFile": [ - "../docker-compose.yml" - ], - "service": "base-service", - "shutdownAction": "none", - "workspaceFolder": "/workspace/codeforlife-portal-react", - "mounts": [ - "source=./codeforlife-package-python,target=/workspace/codeforlife-package-python,type=bind,consistency=cached" - ], - "remoteUser": "root", - "postCreateCommand": "./setup", - "features": { - "ghcr.io/devcontainers/features/python:1": { - "version": "3.8", - "installTools": false - }, - "ghcr.io/devcontainers-contrib/features/pipenv:2": { - "version": "2023.11.15" - }, - "ghcr.io/devcontainers/features/node:1": { - "version": "18" - } - }, "customizations": { "vscode": { - //TODO: Specify preferred settings and extensions once defined + "extensions": [ + "visualstudioexptteam.vscodeintellicode", + "github.vscode-pull-request-github", + "redhat.vscode-yaml", + "davidanson.vscode-markdownlint", + "bierner.markdown-mermaid", + "streetsidesoftware.code-spell-checker", + "dbaeumer.vscode-eslint", + "ms-python.python", + "ms-python.pylint", + "ms-python.isort", + "ms-python.vscode-pylance", + "ms-python.mypy-type-checker", + "ms-python.black-formatter", + "qwtel.sqlite-viewer", + "njpwerner.autodocstring" + ], "settings": { - "python.analysis.extraPaths": [ - "../codeforlife-package-python" - ], - "python.defaultInterpreterPath": "backend/.venv/bin/python", - "autoDocstring.customTemplatePath": ".vscode/extensions/autoDocstring/docstring.mustache", - "files.exclude": { - "**/__pycache__": true, - "**/.pytest_cache": true, - "**/.mypy_cache": true, - "**/.hypothesis": true - }, - "editor.tabSize": 2, - "editor.rulers": [ - 80 - ], - "editor.formatOnSave": true, - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit" - }, - "workbench.colorCustomizations": { - "editorRuler.foreground": "#008000" - }, "[md]": { "editor.tabSize": 4 }, "[python]": { - "editor.tabSize": 4, "editor.defaultFormatter": "ms-python.black-formatter", + "editor.tabSize": 4 }, + "autoDocstring.customTemplatePath": ".vscode/extensions/autoDocstring/docstring.mustache", + "black-formatter.args": [ + "--config", + "pyproject.toml" + ], + "black-formatter.cwd": "${workspaceFolder}/backend", + "black-formatter.path": [ + ".venv/bin/python", + "-m", + "black" + ], "cSpell.words": [ "codeforlife", "klass", "ocado", "kurono", "pipenv" - ] - }, - "extensions": [ - "github.vscode-pull-request-github", - "redhat.vscode-yaml", - "davidanson.vscode-markdownlint", - "bierner.markdown-mermaid", - "ms-python.python", - "ms-python.pylint", - "ms-python.isort", - "ms-python.vscode-pylance", - "ms-python.mypy-type-checker", - "ms-python.black-formatter", - "streetsidesoftware.code-spell-checker", - "tamasfe.even-better-toml", - "kevinrose.vsc-python-indent", - "batisteo.vscode-django", - "njpwerner.autodocstring", - "visualstudioexptteam.vscodeintellicode", - "wholroyd.jinja", - "qwtel.sqlite-viewer" - ] + ], + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "editor.formatOnSave": true, + "editor.rulers": [ + 80 + ], + "editor.tabSize": 2, + "files.exclude": { + "**/.hypothesis": true, + "**/.mypy_cache": true, + "**/.pytest_cache": true, + "**/__pycache__": true + }, + "isort.args": [ + "--settings-file=backend/pyproject.toml" + ], + "isort.path": [ + "backend/.venv/bin/python", + "-m", + "isort" + ], + "mypy-type-checker.args": [ + "--config-file=pyproject.toml" + ], + "mypy-type-checker.cwd": "${workspaceFolder}/backend", + "mypy-type-checker.path": [ + ".venv/bin/python", + "-m", + "mypy" + ], + "pylint.args": [ + "--rcfile=pyproject.toml" + ], + "pylint.cwd": "${workspaceFolder}/backend", + "pylint.path": [ + ".venv/bin/python", + "-m", + "pylint" + ], + "python.analysis.extraPaths": [ + "../codeforlife-package-python" + ], + "python.defaultInterpreterPath": "backend/.venv/bin/python", + "python.testing.cwd": "${workspaceFolder}/backend", + "python.testing.pytestArgs": [ + "-n=auto", + "-c=pyproject.toml", + "." + ], + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false, + "typescript.preferences.quoteStyle": "single", + "workbench.colorCustomizations": { + "editorRuler.foreground": "#008000" + } + } } - } + }, + "dockerComposeFile": [ + "../docker-compose.yml" + ], + "features": { + "ghcr.io/devcontainers-contrib/features/pipenv:2": { + "version": "2023.11.15" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "18" + }, + "ghcr.io/devcontainers/features/python:1": { + "installTools": false, + "version": "3.8" + } + }, + "mounts": [ + "source=./codeforlife-package-javascript,target=/workspace/codeforlife-package-javascript,type=bind,consistency=cached", + "source=./codeforlife-package-python,target=/workspace/codeforlife-package-python,type=bind,consistency=cached" + ], + "name": "portal-react", + "postCreateCommand": "./setup", + "remoteUser": "root", + "service": "base-service", + "shutdownAction": "none", + "workspaceFolder": "/workspace/codeforlife-portal-react" } \ No newline at end of file diff --git a/.vscode/workspace.code-snippets b/.vscode/codeforlife.code-snippets similarity index 71% rename from .vscode/workspace.code-snippets rename to .vscode/codeforlife.code-snippets index 3e6a570c..e45c7bb5 100644 --- a/.vscode/workspace.code-snippets +++ b/.vscode/codeforlife.code-snippets @@ -1,51 +1,49 @@ { - "module.docstring": { + "javascript.module.doccomment": { + "body": [ + "/**", + " * \u00a9 Ocado Group", + " * Created on $CURRENT_DATE/$CURRENT_MONTH/$CURRENT_YEAR at $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND($CURRENT_TIMEZONE_OFFSET).", + " *", + " * ${1:__description__}", + " */" + ], "prefix": [ - "module.docstring", - "\"\"\"", - "'''" + "/" ], - "scope": "python", + "scope": "javascript,typescript,javascriptreact,typescriptreact" + }, + "python.module.docstring": { "body": [ "\"\"\"", - "© Ocado Group", - "Created on $CURRENT_DATE/$CURRENT_MONTH/$CURRENT_YEAR at $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND($CURRENT_TIMEZONE_OFFSET)." + "\u00a9 Ocado Group", + "Created on $CURRENT_DATE/$CURRENT_MONTH/$CURRENT_YEAR at $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND($CURRENT_TIMEZONE_OFFSET).", "", "${1:__description__}", "\"\"\"" - ] - }, - "module.doccomment": { + ], "prefix": [ - "module.doccomment", - "/" + "\"\"\"", + "'''" ], - "scope": "javascript,typescript,javascriptreact,typescriptreact", - "body": [ - "/**", - " * © Ocado Group", - " * Created on $CURRENT_DATE/$CURRENT_MONTH/$CURRENT_YEAR at $CURRENT_HOUR:$CURRENT_MINUTE:$CURRENT_SECOND($CURRENT_TIMEZONE_OFFSET)." - " *", - " * ${1:__description__}", - " */" - ] + "scope": "python" }, - "pylint.disable-next": { + "python.mypy.ignore": { + "body": [ + "# type: ignore[${1:__code_name__}]" + ], "prefix": [ - "# pylint" + "# type" ], - "scope": "python", + "scope": "python" + }, + "python.pylint.disable-next": { "body": [ "# pylint: disable-next=${1:__code_name__}" - ] - }, - "mypy.ignore": { + ], "prefix": [ - "# type" + "# pylint" ], - "scope": "python", - "body": [ - "# type: ignore[${1:__code_name__}]" - ] + "scope": "python" } } \ No newline at end of file diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 7ef36c17..00000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - // See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations. - // Extension identifier format: ${publisher}.${name}. Example: vscode.csharp - - // List of extensions which should be recommended for users of this workspace. - "recommendations": [ - "dbaeumer.vscode-eslint" - ], - // List of extensions recommended by VS Code that should not be recommended for users of this workspace. - "unwantedRecommendations": [ - - ] -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 0a6ac46c..09d7ce2a 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,41 +1,42 @@ { - // 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": [ { - "type": "chrome", + "console": "integratedTerminal", + "justMyCode": false, + "name": "Python: Current File", + "program": "${file}", "request": "launch", - "name": "React Dev Server", - "url": "http://localhost:3000", - "preLaunchTask": "start-react-dev-server" + "type": "debugpy" }, { - "name": "Django Server", - "type": "python", - "request": "launch", - "django": true, "justMyCode": false, - "program": "${workspaceFolder}/backend/manage.py", + "name": "Pytest", + "presentation": { + "hidden": true + }, + "request": "test", + "type": "debugpy" + }, + { + "name": "React Dev Server", + "preLaunchTask": "start-react-dev-server", + "request": "launch", + "type": "chrome", + "url": "http://localhost:3000" + }, + { "args": [ "runserver", "localhost:8000" ], - "preLaunchTask": "migrate-db", - "env": { - "SERVICE_NAME": "portal", - "SERVICE_IS_ROOT": "1" - } - }, - { - "name": "Pytest", - "type": "python", - "request": "test", + "django": true, "justMyCode": false, - "presentation": { - "hidden": true - } + "name": "Django Server", + "preLaunchTask": "migrate-db", + "program": "${workspaceFolder}/backend/manage.py", + "request": "launch", + "type": "debugpy" } - ] + ], + "version": "0.2.0" } \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 28889958..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "editor.tabSize": 2, - "javascript.preferences.quoteStyle": "single", - "typescript.preferences.quoteStyle": "single", - "isort.path": [ - "backend/.venv/bin/python", - "-m", - "isort" - ], - "isort.args": [ - "--settings-file=backend/pyproject.toml" - ], - "black-formatter.path": [ - "backend/.venv/bin/python", - "-m", - "black" - ], - "black-formatter.args": [ - "--config=backend/pyproject.toml" - ], - "mypy-type-checker.cwd": "${workspaceFolder}/backend", - "mypy-type-checker.path": [ - ".venv/bin/python", - "-m", - "mypy" - ], - "mypy-type-checker.args": [ - "--config-file=pyproject.toml" - ], - "pylint.cwd": "${workspaceFolder}/backend", - "pylint.path": [ - ".venv/bin/python", - "-m", - "pylint" - ], - "pylint.args": [ - "--rcfile=pyproject.toml" - ], - "python.testing.cwd": "${workspaceFolder}/backend", - "python.testing.pytestArgs": [ - "-n=auto", - "-c=pyproject.toml", - "." - ], - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true -} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index ed16f832..ed804e8e 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,38 +1,37 @@ { - "version": "2.0.0", - "tasks": [ - { - "isBackground": true, - "type": "npm", - "script": "start", - "options": { - "env": { - "BROWSER": "none", - "REACT_APP_SERVICE_NAME": "portal" - } - }, - "path": "frontend", - "problemMatcher": [], - "label": "start-react-dev-server" - }, - { - "label": "install-dev-deps", - "type": "shell", - "options": { - "cwd": "${workspaceFolder}/backend" - }, - "command": "pipenv install --dev" - }, - { - "label": "migrate-db", - "type": "shell", - "options": { - "cwd": "${workspaceFolder}/backend" - }, - "dependsOn": [ - "install-dev-deps" - ], - "command": "pipenv run python ./manage.py migrate" - } - ] + "tasks": [ + { + "isBackground": true, + "label": "start-react-dev-server", + "options": { + "env": { + "BROWSER": "none" + } + }, + "path": "frontend", + "problemMatcher": [], + "script": "start", + "type": "npm" + }, + { + "command": "pipenv install --dev", + "label": "pipenv-install-dev", + "options": { + "cwd": "${workspaceFolder}/backend" + }, + "type": "shell" + }, + { + "command": "pipenv run python ./manage.py migrate", + "dependsOn": [ + "pipenv-install-dev" + ], + "label": "migrate-db", + "options": { + "cwd": "${workspaceFolder}/backend" + }, + "type": "shell" + } + ], + "version": "2.0.0" } \ No newline at end of file diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace index fdf7f9eb..74bbb6df 100644 --- a/codeforlife.code-workspace +++ b/codeforlife.code-workspace @@ -1,12 +1,12 @@ { "folders": [ { - "path": ".", - "name": "portal-react" + "name": "portal-react", + "path": "." }, { - "path": "../codeforlife-package-python", - "name": "package-python" + "name": "package-python", + "path": "../codeforlife-package-python" } ] } \ No newline at end of file From 33b8abeb371113ed4cc914c448645d3a934e24f2 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 11:43:41 +0000 Subject: [PATCH 3/9] fix settings --- .devcontainer.json | 86 +------------------------------------- .vscode/settings.json | 79 ++++++++++++++++++++++++++++++++++ codeforlife.code-workspace | 8 +++- 3 files changed, 88 insertions(+), 85 deletions(-) create mode 100644 .vscode/settings.json diff --git a/.devcontainer.json b/.devcontainer.json index 48c73650..fc44d97f 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -10,6 +10,7 @@ "streetsidesoftware.code-spell-checker", "dbaeumer.vscode-eslint", "ms-python.python", + "ms-python.debugpy", "ms-python.pylint", "ms-python.isort", "ms-python.vscode-pylance", @@ -17,90 +18,7 @@ "ms-python.black-formatter", "qwtel.sqlite-viewer", "njpwerner.autodocstring" - ], - "settings": { - "[md]": { - "editor.tabSize": 4 - }, - "[python]": { - "editor.defaultFormatter": "ms-python.black-formatter", - "editor.tabSize": 4 - }, - "autoDocstring.customTemplatePath": ".vscode/extensions/autoDocstring/docstring.mustache", - "black-formatter.args": [ - "--config", - "pyproject.toml" - ], - "black-formatter.cwd": "${workspaceFolder}/backend", - "black-formatter.path": [ - ".venv/bin/python", - "-m", - "black" - ], - "cSpell.words": [ - "codeforlife", - "klass", - "ocado", - "kurono", - "pipenv" - ], - "editor.codeActionsOnSave": { - "source.organizeImports": "explicit" - }, - "editor.formatOnSave": true, - "editor.rulers": [ - 80 - ], - "editor.tabSize": 2, - "files.exclude": { - "**/.hypothesis": true, - "**/.mypy_cache": true, - "**/.pytest_cache": true, - "**/__pycache__": true - }, - "isort.args": [ - "--settings-file=backend/pyproject.toml" - ], - "isort.path": [ - "backend/.venv/bin/python", - "-m", - "isort" - ], - "mypy-type-checker.args": [ - "--config-file=pyproject.toml" - ], - "mypy-type-checker.cwd": "${workspaceFolder}/backend", - "mypy-type-checker.path": [ - ".venv/bin/python", - "-m", - "mypy" - ], - "pylint.args": [ - "--rcfile=pyproject.toml" - ], - "pylint.cwd": "${workspaceFolder}/backend", - "pylint.path": [ - ".venv/bin/python", - "-m", - "pylint" - ], - "python.analysis.extraPaths": [ - "../codeforlife-package-python" - ], - "python.defaultInterpreterPath": "backend/.venv/bin/python", - "python.testing.cwd": "${workspaceFolder}/backend", - "python.testing.pytestArgs": [ - "-n=auto", - "-c=pyproject.toml", - "." - ], - "python.testing.pytestEnabled": true, - "python.testing.unittestEnabled": false, - "typescript.preferences.quoteStyle": "single", - "workbench.colorCustomizations": { - "editorRuler.foreground": "#008000" - } - } + ] } }, "dockerComposeFile": [ diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..765e605f --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,79 @@ +{ + "[md]": { + "editor.tabSize": 4 + }, + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + "editor.tabSize": 4 + }, + "black-formatter.args": [ + "--config", + "pyproject.toml" + ], + "black-formatter.cwd": "${workspaceFolder}/backend", + "black-formatter.path": [ + ".venv/bin/python", + "-m", + "black" + ], + "cSpell.words": [ + "codeforlife", + "klass", + "ocado", + "kurono", + "pipenv" + ], + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + }, + "editor.formatOnSave": true, + "editor.rulers": [ + 80 + ], + "editor.tabSize": 2, + "files.exclude": { + "**/.hypothesis": true, + "**/.mypy_cache": true, + "**/.pytest_cache": true, + "**/__pycache__": true + }, + "isort.args": [ + "--settings-file=backend/pyproject.toml" + ], + "isort.path": [ + "backend/.venv/bin/python", + "-m", + "isort" + ], + "mypy-type-checker.args": [ + "--config-file=pyproject.toml" + ], + "mypy-type-checker.cwd": "${workspaceFolder}/backend", + "mypy-type-checker.path": [ + ".venv/bin/python", + "-m", + "mypy" + ], + "pylint.args": [ + "--rcfile=pyproject.toml" + ], + "pylint.cwd": "${workspaceFolder}/backend", + "pylint.path": [ + ".venv/bin/python", + "-m", + "pylint" + ], + "python.analysis.extraPaths": [ + "../codeforlife-package-python" + ], + "python.defaultInterpreterPath": "backend/.venv/bin/python", + "python.testing.cwd": "${workspaceFolder}/backend", + "python.testing.pytestArgs": [ + "-n=auto", + "-c=pyproject.toml", + "." + ], + "python.testing.pytestEnabled": true, + "python.testing.unittestEnabled": false, + "typescript.preferences.quoteStyle": "single" +} \ No newline at end of file diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace index 74bbb6df..a36da177 100644 --- a/codeforlife.code-workspace +++ b/codeforlife.code-workspace @@ -8,5 +8,11 @@ "name": "package-python", "path": "../codeforlife-package-python" } - ] + ], + "settings": { + "autoDocstring.customTemplatePath": ".vscode/extensions/autoDocstring/docstring.mustache", + "workbench.colorCustomizations": { + "editorRuler.foreground": "#008000" + } + } } \ No newline at end of file From 75b5fcb3870fabfa7ff840be723063d7ed26af66 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 12:01:44 +0000 Subject: [PATCH 4/9] add env vars when launching django server --- .vscode/launch.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.vscode/launch.json b/.vscode/launch.json index 09d7ce2a..cbf82419 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -30,6 +30,10 @@ "localhost:8000" ], "django": true, + "env": { + "SERVICE_NAME": "portal", + "SERVICE_IS_ROOT": "1" + }, "justMyCode": false, "name": "Django Server", "preLaunchTask": "migrate-db", From 6292fc96be09d4c7a58fbdc79a0208be2bc4494a Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 12:25:21 +0000 Subject: [PATCH 5/9] add docstring mustache --- .../autoDocstring/docstring.mustache | 35 +++++++++++++++++++ .vscode/launch.json | 4 +-- 2 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .vscode/extensions/autoDocstring/docstring.mustache diff --git a/.vscode/extensions/autoDocstring/docstring.mustache b/.vscode/extensions/autoDocstring/docstring.mustache new file mode 100644 index 00000000..64a5b91a --- /dev/null +++ b/.vscode/extensions/autoDocstring/docstring.mustache @@ -0,0 +1,35 @@ +{{! Based off of: https://github.com/NilsJPWerner/autoDocstring/blob/master/src/docstring/templates/google-notypes.mustache }} +{{summaryPlaceholder}} + +{{extendedSummaryPlaceholder}} +{{#parametersExist}} + +Args: +{{#args}} + {{var}}: {{descriptionPlaceholder}} +{{/args}} +{{#kwargs}} + {{var}}: {{descriptionPlaceholder}} +{{/kwargs}} +{{/parametersExist}} +{{#exceptionsExist}} + +Raises: +{{#exceptions}} + {{type}}: {{descriptionPlaceholder}} +{{/exceptions}} +{{/exceptionsExist}} +{{#returnsExist}} + +Returns: +{{#returns}} + {{descriptionPlaceholder}} +{{/returns}} +{{/returnsExist}} +{{#yieldsExist}} + +Yields: +{{#yields}} + {{descriptionPlaceholder}} +{{/yields}} +{{/yieldsExist}} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index cbf82419..44da6867 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -31,8 +31,8 @@ ], "django": true, "env": { - "SERVICE_NAME": "portal", - "SERVICE_IS_ROOT": "1" + "SERVICE_IS_ROOT": "1", + "SERVICE_NAME": "portal" }, "justMyCode": false, "name": "Django Server", From 765976c516eaac62ba99fdb2f05f9131d5d13aff Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 15:13:12 +0000 Subject: [PATCH 6/9] "Configured submodule [skip ci]" --- codeforlife.code-workspace | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace index a36da177..4634732d 100644 --- a/codeforlife.code-workspace +++ b/codeforlife.code-workspace @@ -1,12 +1,12 @@ { "folders": [ - { - "name": "portal-react", - "path": "." - }, { "name": "package-python", "path": "../codeforlife-package-python" + }, + { + "name": "portal-react", + "path": "." } ], "settings": { From 6030a062b4453233bb8caa105150461d0561b1be Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 15:13:14 +0000 Subject: [PATCH 7/9] "Configured submodule [skip ci]" --- .vscode/launch.json | 34 +++++++++++++++++----------------- .vscode/settings.json | 8 +++++--- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 44da6867..74e50274 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,22 +1,5 @@ { "configurations": [ - { - "console": "integratedTerminal", - "justMyCode": false, - "name": "Python: Current File", - "program": "${file}", - "request": "launch", - "type": "debugpy" - }, - { - "justMyCode": false, - "name": "Pytest", - "presentation": { - "hidden": true - }, - "request": "test", - "type": "debugpy" - }, { "name": "React Dev Server", "preLaunchTask": "start-react-dev-server", @@ -40,6 +23,23 @@ "program": "${workspaceFolder}/backend/manage.py", "request": "launch", "type": "debugpy" + }, + { + "console": "integratedTerminal", + "justMyCode": false, + "name": "Python: Current File", + "program": "${file}", + "request": "launch", + "type": "debugpy" + }, + { + "justMyCode": false, + "name": "Pytest", + "presentation": { + "hidden": true + }, + "request": "test", + "type": "debugpy" } ], "version": "0.2.0" diff --git a/.vscode/settings.json b/.vscode/settings.json index 765e605f..b4b4903d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,12 +38,14 @@ "**/__pycache__": true }, "isort.args": [ - "--settings-file=backend/pyproject.toml" + "--settings-file=backend/pyproject.toml", + "--settings-file=pyproject.toml" ], "isort.path": [ "backend/.venv/bin/python", "-m", - "isort" + "isort", + ".venv/bin/python" ], "mypy-type-checker.args": [ "--config-file=pyproject.toml" @@ -66,7 +68,7 @@ "python.analysis.extraPaths": [ "../codeforlife-package-python" ], - "python.defaultInterpreterPath": "backend/.venv/bin/python", + "python.defaultInterpreterPath": ".venv/bin/python", "python.testing.cwd": "${workspaceFolder}/backend", "python.testing.pytestArgs": [ "-n=auto", From 1a0922a82ed96a54004ee816e14c4d99c4d00005 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Mon, 4 Mar 2024 15:13:15 +0000 Subject: [PATCH 8/9] "Configured submodule [skip ci]" --- .vscode/launch.json | 34 +++++++++++++++++----------------- .vscode/settings.json | 8 +++----- codeforlife.code-workspace | 8 ++++---- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 74e50274..44da6867 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,5 +1,22 @@ { "configurations": [ + { + "console": "integratedTerminal", + "justMyCode": false, + "name": "Python: Current File", + "program": "${file}", + "request": "launch", + "type": "debugpy" + }, + { + "justMyCode": false, + "name": "Pytest", + "presentation": { + "hidden": true + }, + "request": "test", + "type": "debugpy" + }, { "name": "React Dev Server", "preLaunchTask": "start-react-dev-server", @@ -23,23 +40,6 @@ "program": "${workspaceFolder}/backend/manage.py", "request": "launch", "type": "debugpy" - }, - { - "console": "integratedTerminal", - "justMyCode": false, - "name": "Python: Current File", - "program": "${file}", - "request": "launch", - "type": "debugpy" - }, - { - "justMyCode": false, - "name": "Pytest", - "presentation": { - "hidden": true - }, - "request": "test", - "type": "debugpy" } ], "version": "0.2.0" diff --git a/.vscode/settings.json b/.vscode/settings.json index b4b4903d..765e605f 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -38,14 +38,12 @@ "**/__pycache__": true }, "isort.args": [ - "--settings-file=backend/pyproject.toml", - "--settings-file=pyproject.toml" + "--settings-file=backend/pyproject.toml" ], "isort.path": [ "backend/.venv/bin/python", "-m", - "isort", - ".venv/bin/python" + "isort" ], "mypy-type-checker.args": [ "--config-file=pyproject.toml" @@ -68,7 +66,7 @@ "python.analysis.extraPaths": [ "../codeforlife-package-python" ], - "python.defaultInterpreterPath": ".venv/bin/python", + "python.defaultInterpreterPath": "backend/.venv/bin/python", "python.testing.cwd": "${workspaceFolder}/backend", "python.testing.pytestArgs": [ "-n=auto", diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace index 4634732d..a36da177 100644 --- a/codeforlife.code-workspace +++ b/codeforlife.code-workspace @@ -1,12 +1,12 @@ { "folders": [ - { - "name": "package-python", - "path": "../codeforlife-package-python" - }, { "name": "portal-react", "path": "." + }, + { + "name": "package-python", + "path": "../codeforlife-package-python" } ], "settings": { From 0c42b56bd5d37fc9dd3071d48f9671c4be9a9fcd Mon Sep 17 00:00:00 2001 From: SKairinos Date: Tue, 5 Mar 2024 14:24:36 +0000 Subject: [PATCH 9/9] "Configured submodule [skip ci]" --- codeforlife.code-workspace | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/codeforlife.code-workspace b/codeforlife.code-workspace index a36da177..51a0c43f 100644 --- a/codeforlife.code-workspace +++ b/codeforlife.code-workspace @@ -7,6 +7,10 @@ { "name": "package-python", "path": "../codeforlife-package-python" + }, + { + "name": "package-javascript", + "path": "../codeforlife-package-javascript" } ], "settings": {