From a6d5d107ac9271b1cdcea228efb966f6a27cd795 Mon Sep 17 00:00:00 2001 From: Patrik Lindgren <21142447+ggravlingen@users.noreply.github.com> Date: Sun, 18 Sep 2022 10:22:45 +0200 Subject: [PATCH] Improve VSCode experience (#42) --- .devcontainer/Dockerfile.dev | 6 +-- .devcontainer/devcontainer.json | 73 +++++++++++++++------------------ script/bootstrap | 7 +++- script/setup | 2 + 4 files changed, 43 insertions(+), 45 deletions(-) diff --git a/.devcontainer/Dockerfile.dev b/.devcontainer/Dockerfile.dev index 1ce4af3..8118bd1 100644 --- a/.devcontainer/Dockerfile.dev +++ b/.devcontainer/Dockerfile.dev @@ -1,4 +1,4 @@ -ARG VARIANT=3.10-bullseye +ARG VARIANT=3.9-bullseye FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} ENV VIRTUAL_ENV=/opt/.venv @@ -13,6 +13,4 @@ WORKDIR $FILE_LOCATION RUN sudo python3 -m venv $VIRTUAL_ENV && \ sudo chown -R $LOCAL_USER:$LOCAL_USER ${VIRTUAL_ENV} && \ . $VIRTUAL_ENV/bin/activate && \ - python3 -m pip install --upgrade pip setuptools wheel Cython tox && \ - python3 -m pip install -r $FILE_LOCATION/requirements.txt && \ - python3 -m pip install -r $FILE_LOCATION/requirements_test.txt + python3 -m pip install --upgrade pip setuptools wheel Cython tox diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index a849639..e84629d 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,41 +1,36 @@ { - "name": "PYesef dev", - "context": "..", - "dockerFile": "Dockerfile.dev", - "postCreateCommand": "script/setup", - "postStartCommand": "script/bootstrap", - "containerEnv": { - "DEVCONTAINER": "1" - }, - "settings": { - "python.pythonPath": "/opt/.venv/bin/python", - "python.defaultInterpreterPath": "/opt/.venv/bin/python", - "python.terminal.activateEnvInCurrentTerminal": true, - "python.formatting.provider": "black", - "[python]": { - "editor.codeActionsOnSave": { - "source.organizeImports": true - } - }, - "python.formatting.blackArgs": [ - "-S", - "--line-length", - "88" - ], - "python.linting.enabled": true, - "editor.formatOnPaste": true, - "editor.formatOnSave": true, - "editor.formatOnType": true, - "files.trimTrailingWhitespace": true, - "python.languageServer": "Pylance", - "python.testing.unittestEnabled": false, - "python.testing.pytestEnabled": true, - "rainbow_csv.autodetection_min_line_count": 3 - }, - "extensions": [ - "ms-python.vscode-pylance", - "visualstudioexptteam.vscodeintellicode", - "esbenp.prettier-vscode", - "mechatroner.rainbow-csv" - ] + "name": "PyESEF dev", + "context": "..", + "dockerFile": "Dockerfile.dev", + "postCreateCommand": "script/setup", + "containerEnv": { + "DEVCONTAINER": "1" + }, + "settings": { + "python.pythonPath": "/opt/.venv/bin/python", + "python.defaultInterpreterPath": "/opt/.venv/bin/python", + "python.terminal.activateEnvInCurrentTerminal": true, + "python.formatting.provider": "black", + "[python]": { + "editor.codeActionsOnSave": { + "source.organizeImports": true + } + }, + "python.formatting.blackArgs": ["-S", "--line-length", "88"], + "python.linting.enabled": true, + "editor.formatOnPaste": true, + "editor.formatOnSave": true, + "editor.formatOnType": true, + "files.trimTrailingWhitespace": true, + "python.languageServer": "Pylance", + "python.testing.unittestEnabled": false, + "python.testing.pytestEnabled": true, + "rainbow_csv.autodetection_min_line_count": 3 + }, + "extensions": [ + "ms-python.vscode-pylance", + "visualstudioexptteam.vscodeintellicode", + "esbenp.prettier-vscode", + "mechatroner.rainbow-csv" + ] } diff --git a/script/bootstrap b/script/bootstrap index 090610f..a3ee9f3 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -6,6 +6,9 @@ set -e cd "$(dirname "$0")/.." -echo "Installing development dependencies..." +echo "Installing dependencies..." -. $VIRTUAL_ENV/bin/activate && python3 -m pip install -e . \ No newline at end of file +. $VIRTUAL_ENV/bin/activate \ + && python3 -m pip install -r requirements.txt \ + && python3 -m pip install -r requirements_test.txt \ + && python3 -m pip install -e . diff --git a/script/setup b/script/setup index 6f7ec07..1e0fe11 100755 --- a/script/setup +++ b/script/setup @@ -5,4 +5,6 @@ set -e cd "$(dirname "$0")/../" +script/bootstrap + pre-commit install