Skip to content

Commit b39131b

Browse files
authored
Merge pull request #64 from octue/improve-devcontainer
Update devcontainer (tweaked settings and postattach)
2 parents fbd5104 + 52e2fb5 commit b39131b

File tree

3 files changed

+40
-52
lines changed

3 files changed

+40
-52
lines changed

.devcontainer/devcontainer.json

Lines changed: 39 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
22
// https://github.com/microsoft/vscode-dev-containers/tree/v0.187.0/containers/python-3
33
{
4-
"name": "Django GCP",
4+
"name": "Django Twined",
5+
56
"dockerComposeFile": ["docker-compose.yml", "docker-compose.developer.yml"],
67
"service": "web",
78
"workspaceFolder": "/workspace",
@@ -10,57 +11,52 @@
1011
"customizations": {
1112
"vscode": {
1213
"settings": {
13-
"austin.mode": "Wall time",
14+
"[python]": {
15+
"editor.defaultFormatter": "ms-python.black-formatter",
16+
"editor.formatOnSave": true,
17+
"editor.codeActionsOnSave": {
18+
"source.organizeImports": "always",
19+
"source.fixAll": "always"
20+
}
21+
},
1422
"black-formatter.args": ["--line-length", "120"],
23+
"black-formatter.importStrategy": "fromEnvironment",
24+
"isort.args": ["--profile", "black"],
25+
"isort.importStrategy": "fromEnvironment",
26+
"austin.mode": "Wall time",
1527
"editor.defaultFormatter": "esbenp.prettier-vscode",
1628
"editor.formatOnSave": true,
17-
"esbonio.server.enabled": true,
18-
"esbonio.sphinx.confDir": "${workspaceFolder}/docs/source",
1929
"jupyter.widgetScriptSources": ["jsdelivr.com", "unpkg.com"],
20-
"prettier.prettierPath": "/usr/local/prettier",
21-
"python.defaultInterpreterPath": "/usr/local/bin/python",
22-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
23-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
24-
"python.formatting.provider": "black",
25-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
26-
"python.languageServer": "Pylance",
27-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
28-
"python.linting.enabled": true,
29-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
30-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
31-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
32-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
33-
// Disabling specific messages:
30+
// Line length to match black settings
31+
// Disable specific messages:
3432
// - To find the details do: /usr/local/py-utils/bin/pylint --list-msgs
3533
// - Disable missing-module-docstring (C0114) because we don't document modules routinely, just their members
3634
// - Disable invalid-name (C0103) because pylint thinks that eg 'x', 'df', 'np' are invalid due to their lengths
37-
"python.linting.pylintArgs": [
35+
"pylint.args": [
3836
"--max-line-length=120",
39-
"--disable=missing-module-docstring,invalid-name"
40-
],
41-
"python.linting.pylintEnabled": true,
42-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint",
43-
"python.pythonPath": "/usr/local/bin/python",
44-
"python.testing.pytestArgs": [
45-
"--cov=django_gcp",
46-
"--cov-report=xml:cov.xml"
37+
"--disable=missing-module-docstring,invalid-name",
38+
"--load-plugins=pylint_django"
4739
],
48-
// Scrolling the editor is a nice idea but it doesn't work, always out of sync and impossible to manage
49-
"restructuredtext.preview.scrollEditorWithPreview": false,
50-
"restructuredtext.preview.scrollPreviewWithEditor": false,
51-
"restructuredtext.linter.doc8.extraArgs": ["--max-line-length 180"],
52-
"terminal.integrated.defaultProfile.linux": "zsh"
40+
"python.testing.pytestEnabled": true,
41+
"python.testing.unittestEnabled": false,
42+
"terminal.integrated.defaultProfile.linux": "zsh",
43+
// Handle this: https://github.com/microsoft/vscode-python/issues/693
44+
"python.testing.pytestArgs": ["--no-cov"]
5345
},
54-
5546
// Add the IDs of extensions you want installed when the container is created.
5647
"extensions": [
57-
48+
"erikphansen.vscode-toggle-column-selection",
49+
"esbenp.prettier-vscode",
50+
"GitHub.copilot",
51+
"GitHub.copilot-chat",
52+
"github.vscode-github-actions",
5853
"irongeek.vscode-env",
59-
"me-dutour-mathieu.vscode-github-actions",
60-
"mikestead.dotenv",
6154
"ms-python.python",
6255
"ms-python.vscode-pylance",
6356
"ms-python.pylint",
57+
"ms-python.black-formatter",
58+
"ms-python.flake8",
59+
"ms-python.isort",
6460
"ms-toolsai.jupyter",
6561
"ms-toolsai.jupyter-renderers",
6662
"ms-toolsai.jupyter-keymap",
@@ -70,19 +66,19 @@
7066
"shamanu4.django-intellisense",
7167
"thebarkman.vscode-djaneiro",
7268
"trond-snekvik.simple-rst",
73-
"ms-azuretools.vscode-docker",
74-
"ryanluker.vscode-coverage-gutters",
75-
"ms-python.black-formatter"
69+
"4ops.terraform"
7670
]
7771
}
7872
},
7973

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

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

8783
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
8884
"remoteUser": "vscode",
@@ -114,7 +110,6 @@
114110
"ghcr.io/devcontainers/features/node:1": {
115111
"nodeGypDependencies": false,
116112
"version": "latest"
117-
},
118-
"ghcr.io/dhoeric/features/google-cloud-cli:1": {}
113+
}
119114
}
120115
}

.devcontainer/postcreate.sh

Lines changed: 0 additions & 7 deletions
This file was deleted.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-gcp"
3-
version = "0.11.2"
3+
version = "0.11.3"
44
description = "Utilities to run Django on Google Cloud Platform"
55
authors = ["Tom Clark"]
66
license = "MIT"

0 commit comments

Comments
 (0)