Skip to content

Commit

Permalink
Merge pull request #64 from octue/improve-devcontainer
Browse files Browse the repository at this point in the history
Update devcontainer (tweaked settings and postattach)
  • Loading branch information
thclark committed Apr 20, 2024
2 parents fbd5104 + 52e2fb5 commit b39131b
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 52 deletions.
83 changes: 39 additions & 44 deletions .devcontainer/devcontainer.json
@@ -1,7 +1,8 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3
{
"name": "Django GCP",
"name": "Django Twined",

"dockerComposeFile": ["docker-compose.yml", "docker-compose.developer.yml"],
"service": "web",
"workspaceFolder": "/workspace",
Expand All @@ -10,57 +11,52 @@
"customizations": {
"vscode": {
"settings": {
"austin.mode": "Wall time",
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true,
"editor.codeActionsOnSave": {
"source.organizeImports": "always",
"source.fixAll": "always"
}
},
"black-formatter.args": ["--line-length", "120"],
"black-formatter.importStrategy": "fromEnvironment",
"isort.args": ["--profile", "black"],
"isort.importStrategy": "fromEnvironment",
"austin.mode": "Wall time",
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.formatOnSave": true,
"esbonio.server.enabled": true,
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
"prettier.prettierPath": "/usr/local/prettier",
"python.defaultInterpreterPath": "/usr/local/bin/python",
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
"python.formatting.provider": "black",
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
"python.languageServer": "Pylance",
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
"python.linting.enabled": true,
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
// Disabling specific messages:
// Line length to match black settings
// Disable specific messages:
// - To find the details do: /usr/local/py-utils/bin/pylint --list-msgs
// - Disable missing-module-docstring (C0114) because we don't document modules routinely, just their members
// - Disable invalid-name (C0103) because pylint thinks that eg 'x', 'df', 'np' are invalid due to their lengths
"python.linting.pylintArgs": [
"pylint.args": [
"--max-line-length=120",
"--disable=missing-module-docstring,invalid-name"
],
"python.linting.pylintEnabled": true,
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
"python.pythonPath": "/usr/local/bin/python",
"python.testing.pytestArgs": [
"--cov=django_gcp",
"--cov-report=xml:cov.xml"
"--disable=missing-module-docstring,invalid-name",
"--load-plugins=pylint_django"
],
// Scrolling the editor is a nice idea but it doesn't work, always out of sync and impossible to manage
"restructuredtext.preview.scrollEditorWithPreview": false,
"restructuredtext.preview.scrollPreviewWithEditor": false,
"restructuredtext.linter.doc8.extraArgs": ["--max-line-length 180"],
"terminal.integrated.defaultProfile.linux": "zsh"
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"terminal.integrated.defaultProfile.linux": "zsh",
// Handle this: https://github.com/microsoft/vscode-python/issues/693
"python.testing.pytestArgs": ["--no-cov"]
},

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"esbenp.prettier-vscode@2.2.1",
"erikphansen.vscode-toggle-column-selection",
"esbenp.prettier-vscode",
"GitHub.copilot",
"GitHub.copilot-chat",
"github.vscode-github-actions",
"irongeek.vscode-env",
"me-dutour-mathieu.vscode-github-actions",
"mikestead.dotenv",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.pylint",
"ms-python.black-formatter",
"ms-python.flake8",
"ms-python.isort",
"ms-toolsai.jupyter",
"ms-toolsai.jupyter-renderers",
"ms-toolsai.jupyter-keymap",
Expand All @@ -70,19 +66,19 @@
"shamanu4.django-intellisense",
"thebarkman.vscode-djaneiro",
"trond-snekvik.simple-rst",
"ms-azuretools.vscode-docker",
"ryanluker.vscode-coverage-gutters",
"ms-python.black-formatter"
"4ops.terraform"
]
}
},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [80, 443, 5000, 7045, 7046, 7047, 7048, 7049, 8000, 8080],

// Use 'postCreateCommand' to run commands after the container is created.
// Note: Reverting to use pip requirements until we can install private dependencies in GHA with poetry
"postCreateCommand": ". .devcontainer/postcreate.sh",
// Use 'postAttachCommand' to run commands after the container is created and attached (ie git is available).
// This is preferential to postCreateCommand as invoking git (eg for private poetry installs or addition of
// git config preferences) doesn't override injected git configs
// https://stackoverflow.com/a/73097009/3556110
"postAttachCommand": ". .devcontainer/postattach.sh",

// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
"remoteUser": "vscode",
Expand Down Expand Up @@ -114,7 +110,6 @@
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": false,
"version": "latest"
},
"ghcr.io/dhoeric/features/google-cloud-cli:1": {}
}
}
}
7 changes: 0 additions & 7 deletions .devcontainer/postcreate.sh

This file was deleted.

2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "django-gcp"
version = "0.11.2"
version = "0.11.3"
description = "Utilities to run Django on Google Cloud Platform"
authors = ["Tom Clark"]
license = "MIT"
Expand Down

0 comments on commit b39131b

Please sign in to comment.