11{
2- // These test, build and deploy tasks are targeted at a venv
2+ // pyubxutils VSCode workflow.
3+ //
4+ // These build, install and test tasks are targeted at a venv
35 // called 'pygpsclient' located in the user's home directory.
46 // Set your workspace default VSCode Python interpreter to
57 // this venv, i.e.
6- // "${userHome }/pygpsclient/bin/python3" on linux/macos
7- // "${userHome}/pygpsclient/Scripts/python" on windows
8+ // "${userHome }/pygpsclient/bin/python3" on Linux/MacOS
9+ // "C:/Users/user/pygpsclient/Scripts/python.exe" on Windows
10+ //
11+ // The "Test" task will initialise the venv and execute all
12+ // necessary build and installation precursors.
13+ //
814 "version" : " 2.0.0" ,
915 "tasks" : [
16+ {
17+ "label" : " Delete Venv" ,
18+ "type" : " shell" ,
19+ "command" : " rm" ,
20+ "args" : [
21+ " -rf" ,
22+ " ${config:venv}" ,
23+ ],
24+ "problemMatcher" : []
25+ },
1026 {
1127 "label" : " Create Venv" ,
12- "type" : " process " ,
13- "command" : " ${config:python.defaultInterpreterPath }" ,
28+ "type" : " shell " ,
29+ "command" : " ${config:python.systemPath }" ,
1430 "args" : [
1531 " -m" ,
1632 " venv" ,
1733 " ${config:venv}" ,
18- //"--system-site-packages"
1934 ],
20- "problemMatcher" : []
35+ "problemMatcher" : [],
36+ "dependsOrder" : " sequence" ,
37+ "dependsOn" : [
38+ " Delete Venv" ,
39+ ],
2140 },
2241 {
23- "label" : " Run Local Version " ,
24- "type" : " process " ,
25- "command" : " ${config:python.defaultInterpreterPath} " ,
42+ "label" : " Activate Venv " ,
43+ "type" : " shell " ,
44+ "command" : " source " ,
2645 "args" : [
27- " -m" ,
28- " pygpsclient" ,
29- " --ntripcasteruser" ,
30- " semuadmin" ,
31- " --ntripcasterpassword" ,
32- " testpassword" ,
33- " --verbosity" ,
34- " 3"
46+ " ~/pygpsclient/bin/activate" ,
3547 ],
36- "options" : {
37- "cwd" : " src"
38- },
39- "problemMatcher" : []
48+ "problemMatcher" : [],
4049 },
4150 {
4251 "label" : " Install Deploy Dependencies" ,
43- "type" : " process " ,
52+ "type" : " shell " ,
4453 "command" : " ${config:python.defaultInterpreterPath}" ,
4554 "args" : [
4655 " -m" ,
4756 " pip" ,
4857 " install" ,
58+ " --upgrade" ,
4959 " --group" ,
5060 " deploy"
5161 ],
52- "problemMatcher" : []
62+ "problemMatcher" : [],
63+ },
64+ {
65+ "label" : " Install Optional Dependencies" ,
66+ "type" : " shell" ,
67+ "command" : " ${config:python.defaultInterpreterPath}" ,
68+ "args" : [
69+ " -m" ,
70+ " pip" ,
71+ " install" ,
72+ " --upgrade" ,
73+ " --group" ,
74+ " optional"
75+ ],
76+ "problemMatcher" : [],
5377 },
5478 {
5579 "label" : " Clean" ,
6488 " ${config:modulename}.egg-info" ,
6589 ],
6690 "windows" : {
67- "command" : " rm " ,
91+ "command" : " Remove-Item " ,
6892 "args" : [
69- " -R" ,
70- " -Path" ,
71- " 'src/${config:modulename}.egg-info','build','dist','htmlcov','docs/_build'" ,
93+ " -Recurse" ,
94+ " -Force" ,
7295 " -ErrorAction" ,
73- " SilentlyContinue" // doesn't work! - stops on exit code 1 anyway
96+ " SilentlyContinue" , // doesn't work! - stops on exit code 1 anyway
97+ " -Path" ,
98+ " 'build','dist','htmlcov','docs/_build','src/${config:modulename}.egg-info'" ,
7499 ]
75100 },
76101 "options" : {
80105 },
81106 {
82107 "label" : " Sort Imports" ,
83- "type" : " process " ,
108+ "type" : " shell " ,
84109 "command" : " ${config:python.defaultInterpreterPath}" ,
85110 "args" : [
86111 " -m" ,
93118 },
94119 {
95120 "label" : " Format" ,
96- "type" : " process " ,
121+ "type" : " shell " ,
97122 "command" : " ${config:python.defaultInterpreterPath}" ,
98123 "args" : [
99124 " -m" ,
116141 {
117142 "label" : " Security" ,
118143 "type" : " process" ,
119- "command" : " ${config:python.defaultInterpreterPath} " ,
144+ "command" : " bandit " ,
120145 "args" : [
121- " -m" ,
122- " bandit" ,
123146 " -c" ,
124147 " pyproject.toml" ,
125148 " -r" ,
126- " . "
149+ " src/pygpsclient "
127150 ],
128151 "problemMatcher" : []
129152 },
130153 {
131- "label" : " Test " ,
132- "type" : " process " ,
154+ "label" : " Build " ,
155+ "type" : " shell " ,
133156 "command" : " ${config:python.defaultInterpreterPath}" ,
134157 "args" : [
135158 " -m" ,
136- " pytest"
159+ " build" ,
160+ " ." ,
161+ " --wheel" ,
162+ " --sdist" ,
137163 ],
138164 "problemMatcher" : [],
165+ "dependsOrder" : " sequence" ,
166+ "dependsOn" : [
167+ //"Create Venv",
168+ " Install Deploy Dependencies" ,
169+ " Install Optional Dependencies" ,
170+ " Clean" ,
171+ " Sort Imports" ,
172+ " Format" ,
173+ ],
139174 "group" : {
140- "kind" : " test " ,
175+ "kind" : " build " ,
141176 "isDefault" : true
142177 }
143178 },
144179 {
145- "label" : " Build " ,
146- "type" : " process " ,
180+ "label" : " Install " , // into Virtual Environment
181+ "type" : " shell " ,
147182 "command" : " ${config:python.defaultInterpreterPath}" ,
148183 "args" : [
149184 " -m" ,
150- " build" ,
151- " ." ,
152- " --wheel" ,
153- " --sdist" ,
185+ " pip" ,
186+ " install" ,
187+ " --force-reinstall" ,
188+ // wildcard only works on Posix platforms
189+ " ${workspaceFolder}/dist/pyubxutils-*-py3-none-any.whl" ,
190+ ],
191+ "windows" : {
192+ "command" : " ${config:python.defaultInterpreterPath}" ,
193+ "args" : [
194+ " -m" ,
195+ " pip" ,
196+ " install" ,
197+ " --force-reinstall" ,
198+ " ${workspaceFolder}/dist/pyubxutils-1.0.6-py3-none-any.whl" ,
199+ ]
200+ },
201+ "problemMatcher" : [],
202+ },
203+ {
204+ "label" : " Test" ,
205+ "type" : " shell" ,
206+ "command" : " ${config:python.defaultInterpreterPath}" ,
207+ "args" : [
208+ " -m" ,
209+ " pytest"
154210 ],
155211 "problemMatcher" : [],
156212 "dependsOrder" : " sequence" ,
157213 "dependsOn" : [
158- " Clean" ,
159- " Security" ,
160- " Sort Imports" ,
161- " Format" ,
214+ " Activate Venv" ,
215+ " Build" ,
216+ " Install" , // have to install before running pylint
162217 " Pylint" ,
163- " Test" ,
218+ " Security" ,
219+ " Sphinx HTML" ,
164220 ],
165221 "group" : {
166- "kind" : " build " ,
222+ "kind" : " test " ,
167223 "isDefault" : true
168224 }
169225 },
170226 {
171227 "label" : " Sphinx" ,
172- "type" : " process " ,
228+ "type" : " shell " ,
173229 "command" : " sphinx-apidoc" ,
174230 "args" : [
175231 " --ext-autodoc" ,
184240 },
185241 {
186242 "label" : " Sphinx HTML" ,
187- "type" : " process " ,
243+ "type" : " shell " ,
188244 "command" : " /usr/bin/make" ,
189245 "windows" : {
190246 "command" : " ${workspaceFolder}/docs/make.bat"
202258 "problemMatcher" : []
203259 },
204260 {
205- "label" : " Sphinx Deploy to S3 " , // needs AWS credentials
206- "type" : " process " ,
261+ "label" : " Sphinx Deploy" , // needs AWS S3 credentials
262+ "type" : " shell " ,
207263 "command" : " aws" ,
208264 "args" : [
209265 " s3" ,
219275 "problemMatcher" : []
220276 },
221277 {
222- "label" : " Install Locally " ,
223- "type" : " process " ,
224- "command" : " ${config:python.defaultInterpreterPath} " ,
278+ "label" : " Run from Source " ,
279+ "type" : " shell " ,
280+ "command" : " python3 " ,
225281 "args" : [
226282 " -m" ,
227- " pip" ,
228- " install" ,
229- " --upgrade" ,
230- " --force-reinstall" ,
231- " --find-links=${workspaceFolder}/dist" ,
232- " ${workspaceFolderBasename}" ,
233- // "--target",
234- // "${config:venv}/Lib/site-packages"
283+ " pygpsclient" ,
284+ //"--verbosity",
285+ //"3"
235286 ],
236287 "options" : {
237- "cwd" : " dist "
288+ "cwd" : " ${workspaceFolder}/src "
238289 },
239- "dependsOrder" : " sequence" ,
240- "dependsOn" : [
241- " Build" ,
242- " Sphinx HTML"
243- ],
244290 "problemMatcher" : []
245- }
291+ },
246292 ]
247293}
0 commit comments