From d140419da85f2489631805d3a88b3defd9b16d3d Mon Sep 17 00:00:00 2001 From: Davor Runje Date: Mon, 1 Jul 2024 07:50:40 +0000 Subject: [PATCH] .devcontainer added --- .devcontainer/devcontainer.env | 4 ++ .devcontainer/python-3.10/devcontainer.json | 57 ++++++++++++++++++++ .devcontainer/python-3.10/docker-compose.yml | 30 +++++++++++ .devcontainer/python-3.11/devcontainer.json | 57 ++++++++++++++++++++ .devcontainer/python-3.11/docker-compose.yml | 30 +++++++++++ .devcontainer/python-3.12/devcontainer.json | 57 ++++++++++++++++++++ .devcontainer/python-3.12/docker-compose.yml | 30 +++++++++++ .devcontainer/python-3.9/devcontainer.json | 57 ++++++++++++++++++++ .devcontainer/python-3.9/docker-compose.yml | 30 +++++++++++ .devcontainer/setup.sh | 26 +++++++++ 10 files changed, 378 insertions(+) create mode 100644 .devcontainer/devcontainer.env create mode 100644 .devcontainer/python-3.10/devcontainer.json create mode 100644 .devcontainer/python-3.10/docker-compose.yml create mode 100644 .devcontainer/python-3.11/devcontainer.json create mode 100644 .devcontainer/python-3.11/docker-compose.yml create mode 100644 .devcontainer/python-3.12/devcontainer.json create mode 100644 .devcontainer/python-3.12/docker-compose.yml create mode 100644 .devcontainer/python-3.9/devcontainer.json create mode 100644 .devcontainer/python-3.9/docker-compose.yml create mode 100644 .devcontainer/setup.sh diff --git a/.devcontainer/devcontainer.env b/.devcontainer/devcontainer.env new file mode 100644 index 0000000..31bf13c --- /dev/null +++ b/.devcontainer/devcontainer.env @@ -0,0 +1,4 @@ +PORT_PREFIX=${PORT_PREFIX} +CONTAINER_PREFIX=${USER} + +GOOGLE_SHEETS_CLIENT_SECRET=${GOOGLE_SHEETS_CLIENT_SECRET} diff --git a/.devcontainer/python-3.10/devcontainer.json b/.devcontainer/python-3.10/devcontainer.json new file mode 100644 index 0000000..696ea7d --- /dev/null +++ b/.devcontainer/python-3.10/devcontainer.json @@ -0,0 +1,57 @@ +{ + "name": "python-3.10", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.10", + "forwardPorts": [], + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/google-sheets", + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": true + }, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "postCreateCommand": [], + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.10/docker-compose.yml b/.devcontainer/python-3.10/docker-compose.yml new file mode 100644 index 0000000..ce1a780 --- /dev/null +++ b/.devcontainer/python-3.10/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + python-3.10: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.10 + container_name: $USER-python-3.10-google-sheets + volumes: + - ../../:/workspaces/google-sheets:cached + command: sleep infinity + environment: + - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-google-sheets:5432/google-sheets + env_file: + - ../devcontainer.env + networks: + - google-sheets-network + postgres-google-sheets: # nosemgrep + image: postgres:latest + container_name: $USER-postgres-py39-google-sheets + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password # pragma: allowlist secret + POSTGRES_DB: google-sheets + # ports: + # - "${PORT_PREFIX}5432:5432" + networks: + - google-sheets-network + +networks: + google-sheets-network: + name: "${USER}-google-sheets-network" diff --git a/.devcontainer/python-3.11/devcontainer.json b/.devcontainer/python-3.11/devcontainer.json new file mode 100644 index 0000000..4511947 --- /dev/null +++ b/.devcontainer/python-3.11/devcontainer.json @@ -0,0 +1,57 @@ +{ + "name": "python-3.11", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.11", + "forwardPorts": [], + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/google-sheets", + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": true + }, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "postCreateCommand": [], + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.11/docker-compose.yml b/.devcontainer/python-3.11/docker-compose.yml new file mode 100644 index 0000000..35de7bc --- /dev/null +++ b/.devcontainer/python-3.11/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + python-3.11: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.11 + container_name: $USER-python-3.11-google-sheets + volumes: + - ../../:/workspaces/google-sheets:cached + command: sleep infinity + environment: + - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-google-sheets:5432/google-sheets + env_file: + - ../devcontainer.env + networks: + - google-sheets-network + postgres-google-sheets: # nosemgrep + image: postgres:latest + container_name: $USER-postgres-py39-google-sheets + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password # pragma: allowlist secret + POSTGRES_DB: google-sheets + # ports: + # - "${PORT_PREFIX}5432:5432" + networks: + - google-sheets-network + +networks: + google-sheets-network: + name: "${USER}-google-sheets-network" diff --git a/.devcontainer/python-3.12/devcontainer.json b/.devcontainer/python-3.12/devcontainer.json new file mode 100644 index 0000000..4f177cd --- /dev/null +++ b/.devcontainer/python-3.12/devcontainer.json @@ -0,0 +1,57 @@ +{ + "name": "python-3.12", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.12", + "forwardPorts": [], + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/google-sheets", + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": true + }, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "postCreateCommand": [], + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.12/docker-compose.yml b/.devcontainer/python-3.12/docker-compose.yml new file mode 100644 index 0000000..82b25d6 --- /dev/null +++ b/.devcontainer/python-3.12/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + python-3.12: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.12 + container_name: $USER-python-3.12-google-sheets + volumes: + - ../../:/workspaces/google-sheets:cached + command: sleep infinity + environment: + - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-google-sheets:5432/google-sheets + env_file: + - ../devcontainer.env + networks: + - google-sheets-network + postgres-google-sheets: # nosemgrep + image: postgres:latest + container_name: $USER-postgres-py39-google-sheets + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password # pragma: allowlist secret + POSTGRES_DB: google-sheets + # ports: + # - "${PORT_PREFIX}5432:5432" + networks: + - google-sheets-network + +networks: + google-sheets-network: + name: "${USER}-google-sheets-network" diff --git a/.devcontainer/python-3.9/devcontainer.json b/.devcontainer/python-3.9/devcontainer.json new file mode 100644 index 0000000..fe45a9e --- /dev/null +++ b/.devcontainer/python-3.9/devcontainer.json @@ -0,0 +1,57 @@ +{ + "name": "python-3.9", + "dockerComposeFile": [ + "./docker-compose.yml" + ], + "service": "python-3.9", + "forwardPorts": [], + "shutdownAction": "stopCompose", + "workspaceFolder": "/workspaces/google-sheets", + "remoteEnv": {}, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": { + "installZsh": true, + "installOhMyZsh": true, + "configureZshAsDefaultShell": true, + "username": "vscode", + "userUid": "1000", + "userGid": "1000" + }, + "ghcr.io/devcontainers/features/node:1": {}, + "ghcr.io/devcontainers/features/git:1": { + "version": "latest", + "ppa": true + }, + "ghcr.io/devcontainers/features/git-lfs:1": {}, + "ghcr.io/robbert229/devcontainer-features/postgresql-client:1": {} + }, + "updateContentCommand": "bash .devcontainer/setup.sh", + "postCreateCommand": [], + "customizations": { + "vscode": { + "settings": { + "python.linting.enabled": true, + "python.testing.pytestEnabled": true, + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "always" + }, + "[python]": { + "editor.defaultFormatter": "ms-python.vscode-pylance" + }, + "editor.rulers": [ + 80 + ] + }, + "extensions": [ + "ms-python.python", + "ms-toolsai.jupyter", + "ms-toolsai.vscode-jupyter-cell-tags", + "ms-toolsai.jupyter-keymap", + "ms-toolsai.jupyter-renderers", + "ms-toolsai.vscode-jupyter-slideshow", + "ms-python.vscode-pylance" + ] + } + } +} diff --git a/.devcontainer/python-3.9/docker-compose.yml b/.devcontainer/python-3.9/docker-compose.yml new file mode 100644 index 0000000..342c8e7 --- /dev/null +++ b/.devcontainer/python-3.9/docker-compose.yml @@ -0,0 +1,30 @@ +version: '3' + +services: + python-3.9: # nosemgrep + image: mcr.microsoft.com/devcontainers/python:3.9 + container_name: $USER-python-3.9-google-sheets + volumes: + - ../../:/workspaces/google-sheets:cached + command: sleep infinity + environment: + - DATABASE_URL=postgresql://admin:password@${USER}-postgres-py39-google-sheets:5432/google-sheets + env_file: + - ../devcontainer.env + networks: + - google-sheets-network + postgres-google-sheets: # nosemgrep + image: postgres:latest + container_name: $USER-postgres-py39-google-sheets + environment: + POSTGRES_USER: admin + POSTGRES_PASSWORD: password # pragma: allowlist secret + POSTGRES_DB: google-sheets + # ports: + # - "${PORT_PREFIX}5432:5432" + networks: + - google-sheets-network + +networks: + google-sheets-network: + name: "${USER}-google-sheets-network" diff --git a/.devcontainer/setup.sh b/.devcontainer/setup.sh new file mode 100644 index 0000000..3a9afaa --- /dev/null +++ b/.devcontainer/setup.sh @@ -0,0 +1,26 @@ +# update pip +pip install --upgrade pip + +# install dev packages +pip install -e ".[dev]" + +# install pre-commit hook if not installed already +pre-commit install + +prisma migrate deploy +prisma generate + +echo '{ + "web": { + "client_id": "1027914582771-g0bcsn4fhd6a59pp3d4n1ntjc03r1k9s.apps.googleusercontent.com", + "project_id": "captn-sheets-dev", + "auth_uri": "https://accounts.google.com/o/oauth2/auth", + "token_uri": "https://oauth2.googleapis.com/token", + "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs", + "client_secret": "'${GOOGLE_SHEETS_CLIENT_SECRET}'", + "redirect_uris": [ + "http://localhost:8000/login/callback" + ] + + } +}' > client_secret.json