Skip to content

Commit

Permalink
simplify dev container setup (#312)
Browse files Browse the repository at this point in the history
* simplify dev container setup

* synced with submodule configs

* fix settings

* add env vars when launching django server

* add docstring mustache

* "Configured submodule [skip ci]"

* "Configured submodule [skip ci]"

* "Configured submodule [skip ci]"

* "Configured submodule [skip ci]"

* Merge branch 'development' into mount_py_package
  • Loading branch information
SKairinos authored Mar 5, 2024
1 parent 6a262fa commit a6a0d77
Show file tree
Hide file tree
Showing 10 changed files with 302 additions and 158 deletions.
49 changes: 49 additions & 0 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"customizations": {
"vscode": {
"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.debugpy",
"ms-python.pylint",
"ms-python.isort",
"ms-python.vscode-pylance",
"ms-python.mypy-type-checker",
"ms-python.black-formatter",
"qwtel.sqlite-viewer",
"njpwerner.autodocstring"
]
}
},
"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"
}
Original file line number Diff line number Diff line change
@@ -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"
}
}
13 changes: 0 additions & 13 deletions .vscode/extensions.json

This file was deleted.

35 changes: 35 additions & 0 deletions .vscode/extensions/autoDocstring/docstring.mustache
Original file line number Diff line number Diff line change
@@ -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}}
57 changes: 31 additions & 26 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,41 +1,46 @@
{
// 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",
"django": true,
"env": {
"SERVICE_NAME": "portal",
"SERVICE_IS_ROOT": "1"
}
},
{
"name": "Pytest",
"type": "python",
"request": "test",
"SERVICE_IS_ROOT": "1",
"SERVICE_NAME": "portal"
},
"justMyCode": false,
"presentation": {
"hidden": true
}
"name": "Django Server",
"preLaunchTask": "migrate-db",
"program": "${workspaceFolder}/backend/manage.py",
"request": "launch",
"type": "debugpy"
}
]
],
"version": "0.2.0"
}
122 changes: 77 additions & 45 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,47 +1,79 @@
{
"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
"[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"
}
Loading

0 comments on commit a6a0d77

Please sign in to comment.