Skip to content

Commit 1f636ca

Browse files
committed
Add remote debugging section to documentation and include related images
1 parent 9052853 commit 1f636ca

File tree

6 files changed

+74
-5
lines changed

6 files changed

+74
-5
lines changed

docs/debug.md

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,84 @@ IoP is based on [Embedded Python in IRIS](https://docs.intersystems.com/iris2024
1616

1717
Embedded Python is a feature of IRIS that allows you to run Python code inside IRIS.
1818

19-
That means the python code is not running by a python interpreter, but by the IRIS process.
19+
That means the python code is not running by a python interpreter, but by an IRIS process.
2020

21-
That comes with some limitations, like the lack of a debugger. It's planned to have a debugger in the future. eg: IRIS 2025.2+.
21+
## Remote Debugging
2222

23-
Meanwhile, we **have** some ways to debug the code.
23+
To remote debbug your code, you need IoP version 3.4.1 or later.
2424

25-
## Debugging
25+
You will then have access to new options in the management portal.
2626

27-
Today (2025.2-), the best way to debug the code is to use an native python interpreter and run the code outside IRIS. This way you can use the python debugger.
27+
![Remote Debugging](./img/RemoteDebugOptions.png)
28+
29+
### Debugging Options
30+
31+
- **Enable Debugging**: This option will enable the remote debugging.
32+
- **Debugging Port**: This option will set the port for the remote debugging. The default port is 0. If you set it to 0, the system will choose a random port. You can also set it to a specific port.
33+
- **Debugging Interpreter**: In the background, the system will create a new python interpreter. This option will set the interpreter to use. **In most cases, you don't need to change this option.**
34+
35+
Then when you start the process, you will see the following message in the logs:
36+
37+
![Debugging Port](./img/RemoteDebugWaiting.png)
38+
39+
This means that the system is waiting for a connection on the port you set.
40+
41+
Then you can connect to the port with your IDE.
42+
43+
If you wait too long, the system will close the port and you will need to restart the process.
44+
![Debugging Port](./img/RemoteDebugToLate.png)
45+
46+
If VsCode is connected to the port, you will see the following message in the logs:
47+
![Debugging Port](./img/RemoteDebugSuccess.png)
48+
This means that the system is connected to the port and you can start debugging.
49+
50+
### Debugging with VSCode
51+
52+
To debug the code with VSCode, you need to have the following:
53+
- [VSCode](https://code.visualstudio.com/)
54+
- [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
55+
56+
Then you need to create a new launch configuration for remote debugging.
57+
58+
You can follow the steps in the [VSCode documentation](https://code.visualstudio.com/docs/python/debugging#_initialize-configurations) to initialize the configurations.
59+
You can also use the following configuration:
60+
61+
```json
62+
{
63+
"version": "0.2.0",
64+
"configurations": [
65+
{
66+
"name": "Python: Remote Debug",
67+
"type": "python",
68+
"request": "attach",
69+
"connect": {
70+
"host": "<IRIS_HOST>",
71+
"port": <IRIS_DEBUG_PORT>
72+
},
73+
"pathMappings": [
74+
{
75+
"localRoot": "${workspaceFolder}",
76+
"remoteRoot": "/irisdev/app" // for example path inside the container
77+
}
78+
],
79+
}
80+
]
81+
}
82+
```
83+
You need to change the `<IRIS_HOST>` and `<IRIS_DEBUG_PORT>` to the host and port of your IRIS instance.
84+
You also need to change the `pathMappings` to the path of your python file in IRIS and the path of your python file in your local machine.
85+
The path in IRIS is the path of the file in the IRIS instance. The path in your local machine is the path of the file in your local machine.
86+
87+
### Example
88+
89+
<video controls width="640" height="360">
90+
<source src="/img/IoPRemoteDebug.mp4" type="video/mp4">
91+
</video>
92+
93+
94+
## Local Debugging
95+
96+
The idea of local debugging is to use an native python interpreter and run the code outside IRIS. This way you can use the python debugger.
2897

2998
The main issue with this approach is that you must have a local instance of IRIS to be able to run the code.
3099

docs/img/IoPRemoteDebug.mp4

4.5 MB
Binary file not shown.

docs/img/RemoteDebugOptions.png

171 KB
Loading

docs/img/RemoteDebugSuccess.png

317 KB
Loading

docs/img/RemoteDebugToLate.png

297 KB
Loading

docs/img/RemoteDebugWaiting.png

326 KB
Loading

0 commit comments

Comments
 (0)