Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev container clean up #16

Merged
merged 9 commits into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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": "sso",
"postCreateCommand": "./setup",
"remoteUser": "root",
"service": "base-service",
"shutdownAction": "none",
"workspaceFolder": "/workspace/codeforlife-sso"
}
49 changes: 49 additions & 0 deletions .vscode/codeforlife.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"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": [
"/"
],
"scope": "javascript,typescript,javascriptreact,typescriptreact"
},
"python.module.docstring": {
"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": [
"\"\"\"",
"'''"
],
"scope": "python"
},
"python.mypy.ignore": {
"body": [
"# type: ignore[${1:__code_name__}]"
],
"prefix": [
"# type"
],
"scope": "python"
},
"python.pylint.disable-next": {
"body": [
"# pylint: disable-next=${1:__code_name__}"
],
"prefix": [
"# pylint"
],
"scope": "python"
}
}
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}}
50 changes: 31 additions & 19 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,34 +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": [
{
"name": "Django Server",
"type": "python",
"console": "integratedTerminal",
"justMyCode": false,
"name": "Python: Current File",
"program": "${file}",
"request": "launch",
"django": true,
"type": "debugpy"
},
{
"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:8001"
],
"preLaunchTask": "migrate-db",
"django": true,
"env": {
"SERVICE_NAME": "sso",
"SERVICE_PORT": "8001"
}
},
{
"name": "Pytest",
"type": "python",
"request": "test",
},
"justMyCode": false,
"presentation": {
"hidden": true
}
"name": "Django Server",
"preLaunchTask": "migrate-db",
"program": "${workspaceFolder}/backend/manage.py",
"request": "launch",
"type": "debugpy"
}
]
],
"version": "0.2.0"
}
75 changes: 71 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,79 @@
{
"[md]": {
"editor.tabSize": 4
},
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.tabSize": 4
},
"black-formatter.args": [
"--config",
"backend/pyproject.toml"
"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": [
"-c=backend/pyproject.toml",
"backend"
"-n=auto",
"-c=pyproject.toml",
"."
],
"python.testing.pytestEnabled": true,
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true
"typescript.preferences.quoteStyle": "single"
}
33 changes: 23 additions & 10 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "install-dev-deps",
"type": "shell",
"isBackground": true,
"label": "start-react-dev-server",
"options": {
"cwd": "${workspaceFolder}/backend"
"env": {
"BROWSER": "none"
}
},
"command": "pipenv install --dev"
"path": "frontend",
"problemMatcher": [],
"script": "start",
"type": "npm"
},
{
"label": "migrate-db",
"type": "shell",
"command": "pipenv install --dev",
"label": "pipenv-install-dev",
"options": {
"cwd": "${workspaceFolder}/backend"
},
"type": "shell"
},
{
"command": "pipenv run python ./manage.py migrate",
"dependsOn": [
"install-dev-deps"
"pipenv-install-dev"
],
"command": "pipenv run python ./manage.py migrate"
"label": "migrate-db",
"options": {
"cwd": "${workspaceFolder}/backend"
},
"type": "shell"
}
]
],
"version": "2.0.0"
}
File renamed without changes.
36 changes: 23 additions & 13 deletions backend/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,33 @@ url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

## ℹ️ HOW-TO: Make the python-package editable.
#
# 1. Comment out the git-codeforlife package under [packages].
# 2. Comment out the git-codeforlife package under [dev-packages].
# 3. Uncomment the editable-codeforlife package under [dev-packages].
# 4. Run `pipenv install --dev` in your terminal.
#
# ⚠️ Make sure you revert these changes before pushing your changes or the
# pipeline will fail to install the python-package.
#
## ℹ️ HOW-TO: Install a new version of the python-package.
#
# 1. Uncomment the git-codeforlife package under [packages].
# 2. Uncomment the git-codeforlife package under [dev-packages].
# 3. Comment out the editable-codeforlife package under [dev-packages].
# 4. Set the ref key of the git-codeforlife packages under [packages] and
# [dev-packages] to have the same version number.
# 5. Run `pipenv install --dev` in your terminal.

[packages]
codeforlife = {ref = "v0.8.3", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
django = "==3.2.20"
djangorestframework = "==3.13.1"
django-cors-headers = "==4.1.0"
# https://pypi.org/user/codeforlife/
cfl-common = "==6.37.1" # TODO: remove
codeforlife-portal = "==6.37.1" # TODO: remove
aimmo = "==2.10.6" # TODO: remove
rapid-router = "==5.11.3" # TODO: remove
phonenumbers = "==8.12.12" # TODO: remove
# 🚫 Don't add [packages] below that are inhertited from the CFL package

[dev-packages]
black = "*"
pytest-django = "==4.5.2"
pytest = "==7.*"
pytest-env = "==0.8.2"
codeforlife = {ref = "v0.8.3", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
# codeforlife = {file = "../../codeforlife-package-python", editable = true, extras = ["dev"]}
# 🚫 Don't add [dev-packages] below that are inhertited from the CFL package.

[requires]
python_version = "3.8"
Loading
Loading