Skip to content

Commit cf5dd9e

Browse files
author
Damian Wysokinski
committed
added shared launches
1 parent 137998f commit cf5dd9e

File tree

2 files changed

+244
-0
lines changed

2 files changed

+244
-0
lines changed

.devcontainer/shared/launch.json

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: FastAPI",
6+
"type": "debugpy",
7+
"request": "launch",
8+
"module": "uvicorn",
9+
"args": [
10+
"api.main:app",
11+
"--host",
12+
"0.0.0.0",
13+
"--port",
14+
"8000",
15+
"--reload"
16+
],
17+
"cwd": "${workspaceFolder}/python",
18+
"env": {
19+
"PYTHONPATH": "${workspaceFolder}/python"
20+
},
21+
"jinja": true,
22+
"justMyCode": false
23+
},
24+
{
25+
"name": "Azure Functions: All Functions (Start All)",
26+
"type": "debugpy",
27+
"request": "attach",
28+
"connect": {
29+
"host": "localhost",
30+
"port": 9091
31+
},
32+
"preLaunchTask": "Start Azure Functions with Debugger",
33+
"pathMappings": [
34+
{
35+
"localRoot": "${workspaceFolder}/python",
36+
"remoteRoot": "/home/site/wwwroot"
37+
}
38+
],
39+
"justMyCode": false
40+
},
41+
{
42+
"name": "Azure Functions: Debug",
43+
"type": "debugpy",
44+
"request": "attach",
45+
"connect": {
46+
"host": "localhost",
47+
"port": 9091
48+
},
49+
"preLaunchTask": "Start Azure Functions with Debugger",
50+
"pathMappings": [
51+
{
52+
"localRoot": "${workspaceFolder}/python",
53+
"remoteRoot": "/home/site/wwwroot"
54+
}
55+
]
56+
},
57+
{
58+
"name": "Attach to Python Functions",
59+
"type": "debugpy",
60+
"request": "attach",
61+
"connect": {
62+
"host": "localhost",
63+
"port": 9091
64+
},
65+
"pathMappings": [
66+
{
67+
"localRoot": "${workspaceFolder}/python",
68+
"remoteRoot": "/home/site/wwwroot"
69+
}
70+
]
71+
},
72+
{
73+
"name": "Azure Functions: Python (Local)",
74+
"type": "debugpy",
75+
"request": "launch",
76+
"module": "azure_functions_worker",
77+
"args": [
78+
"--host",
79+
"127.0.0.1",
80+
"--port",
81+
"7071",
82+
"--worker-id",
83+
"test-worker"
84+
],
85+
"cwd": "${workspaceFolder}/python",
86+
"env": {
87+
"PYTHONPATH": "${workspaceFolder}/python",
88+
"AzureWebJobsScriptRoot": "${workspaceFolder}/python"
89+
},
90+
"console": "integratedTerminal"
91+
},
92+
{
93+
"name": "Python: Current File",
94+
"type": "debugpy",
95+
"request": "launch",
96+
"program": "${file}",
97+
"console": "integratedTerminal",
98+
"cwd": "${workspaceFolder}/python",
99+
"env": {
100+
"PYTHONPATH": "${workspaceFolder}/python"
101+
}
102+
},
103+
{
104+
"name": "Python: Pytest",
105+
"type": "debugpy",
106+
"request": "launch",
107+
"module": "pytest",
108+
"args": [
109+
"-v",
110+
"${file}"
111+
],
112+
"console": "integratedTerminal",
113+
"cwd": "${workspaceFolder}/python",
114+
"env": {
115+
"PYTHONPATH": "${workspaceFolder}/python"
116+
}
117+
},
118+
{
119+
"name": "Attach to Python Functions dwys",
120+
"type": "debugpy",
121+
"request": "attach",
122+
"connect": {
123+
"host": "localhost",
124+
"port": 9091
125+
},
126+
"preLaunchTask": "func: host start"
127+
}
128+
]
129+
}

.devcontainer/shared/tasks.json

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "Run FastAPI Development Server",
6+
"type": "shell",
7+
"command": "cd python && uvicorn api.main:app --host 0.0.0.0 --port 8000 --reload",
8+
"problemMatcher": [],
9+
"presentation": {
10+
"reveal": "always",
11+
"panel": "new"
12+
},
13+
"isBackground": true,
14+
"group": {
15+
"kind": "build",
16+
"isDefault": true
17+
}
18+
},
19+
{
20+
"label": "Start Azure Functions",
21+
"type": "shell",
22+
"command": "cd python && func start --port 7071",
23+
"problemMatcher": [],
24+
"presentation": {
25+
"reveal": "always",
26+
"panel": "new"
27+
},
28+
"isBackground": true,
29+
"group": "none"
30+
},
31+
{
32+
"label": "Start Azure Functions (Debug Mode)",
33+
"type": "shell",
34+
"command": "cd python && func start --port 7071 --verbose",
35+
"problemMatcher": [],
36+
"presentation": {
37+
"reveal": "always",
38+
"panel": "new"
39+
},
40+
"isBackground": true
41+
},
42+
{
43+
"label": "Start Azure Functions with Debugger",
44+
"type": "shell",
45+
"command": "cd python && func start --port 7071 --python-debug-port 9091",
46+
"problemMatcher": [
47+
{
48+
"pattern": [
49+
{
50+
"regexp": ".",
51+
"file": 1,
52+
"location": 2,
53+
"message": 3
54+
}
55+
],
56+
"background": {
57+
"activeOnStart": true,
58+
"beginsPattern": ".*Azure Functions Core Tools.*",
59+
"endsPattern": ".*(Worker process started and initialized|Host started|Job host started).*"
60+
}
61+
}
62+
],
63+
"presentation": {
64+
"reveal": "always",
65+
"panel": "dedicated"
66+
},
67+
"isBackground": true,
68+
"runOptions": {
69+
"instanceLimit": 1
70+
}
71+
},
72+
{
73+
"label": "Install Python Dependencies",
74+
"type": "shell",
75+
"command": "pip install -r python/requirements.txt",
76+
"problemMatcher": []
77+
},
78+
{
79+
"label": "Run Tests",
80+
"type": "shell",
81+
"command": "cd python && pytest",
82+
"problemMatcher": [],
83+
"presentation": {
84+
"reveal": "always",
85+
"panel": "shared"
86+
}
87+
},
88+
{
89+
"label": "Database: Run Migrations",
90+
"type": "shell",
91+
"command": "psql -h localhost -U postgres -d analytics -f db/sql/100_create_global_objects.sql",
92+
"problemMatcher": []
93+
},
94+
{
95+
"label": "Trigger HTTP Function (httpPreprocess)",
96+
"type": "shell",
97+
"command": "curl -X POST http://localhost:7071/httpPreprocess",
98+
"problemMatcher": []
99+
},
100+
{
101+
"type": "func",
102+
"label": "func: host start",
103+
"command": "start",
104+
"problemMatcher": "$func-python-watch",
105+
"isBackground": true,
106+
// "dependsOn": "pip install (functions)",
107+
"options": {
108+
"cwd": "${workspaceFolder}/python",
109+
"env": {
110+
"languageWorkers__python__arguments": "-m debugpy --listen 127.0.0.1:9091"
111+
}
112+
}
113+
}
114+
]
115+
}

0 commit comments

Comments
 (0)