Update Development authored by Alexian MASSON's avatar Alexian MASSON
wip
\ No newline at end of file
# Development
Plugin source code is in folder `PreCourlis`.
Recommended development environment is Linux.
You can also use Windows but you'll not have the help of `make` targets.
Automated tests suite can be run with Docker on any Linux operating system.
## Build development docker image
```bash
make build
```
This will build the docker image named `camptocamp/edf-precourlis-builder` and
build or retrieve some runtime files:
- PreCourlis/ui/resources_rc.py (generated from PreCourlis/resources/resources.qrc)
- PreCourlis/lib/TatooineMesher (cloned from https://github.com/arnaud-morvan/TatooineMesher/tree/PreCourlis)
This image will be later used to run a QGIS desktop application in a adapted environment or to run automated tests suite.
## debugging with VS Code
When QGIS desktop is started with Docker (`make qgis`), or when `debugpy` is available from QGIS Python process, PreCourlis plugin automatically create a menu action to make debugpy listen on port 5679 and wait for client.
When tests are run with target `test-debug`, the tests session first make debugpy listen on host port 5680 and wait for client before running any test. You will have to connect to running `debugpy` server from VS Code before any test start.
```bash
make test-debug
```
Then in VS Code configure your `launch.json` file with something like:
```json
{
// 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": "Python: QGIS",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5679
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"justMyCode": true
},
{
"name": "Python: Tests",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5680
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/app"
}
],
"justMyCode": true
}
]
}
```
And now you can easily connect to the Python process from VS Code for debugging.
\ No newline at end of file