Skip to content

Commit 0e3d954

Browse files
authored
Merge pull request #93 from brichet/debugger_info_copy_to_globals
JEP for copy-to-globals support in debugger_info
2 parents 0116beb + 109c920 commit 0e3d954

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
title: Debugger support to copyToGlobals
3+
authors: Nicolas Brichet (@brichet)
4+
issue-number: xxx
5+
pr-number: xxx
6+
date-started: 2023-02-20
7+
---
8+
9+
# Summary
10+
11+
This JEP introduces a new field to the kernel debugger_info response. This new
12+
field will inform the UI that the debugger supports the `copyToGlobals` request.
13+
14+
# Motivation
15+
16+
The `copyToGlobals` request has been introduced in
17+
[ipykernel](https://github.com/ipython/ipykernel/pull/1055) and in
18+
[xeus-python](https://github.com/jupyter-xeus/xeus-python/pull/562) to copy a local
19+
variable to the global scope during a breakpoint. It would be useful to inform the
20+
UI if this is supported by the kernel before displaying the corresponding menu entry.
21+
22+
# Proposed Enhancement
23+
24+
We propose to add a new `copyToGlobals` boolean field to the `debugger_info`
25+
response which will inform the UI that this request is supported.
26+
27+
## Reference-level explanation
28+
29+
This boolean flag should be included in the `debugger_info` response from the kernel
30+
which supports the feature. It is optional, assuming that its absence is understood
31+
as `false` from the client perspective.
32+
33+
If the feature is supported, the kernel must provide a function for copying a variable
34+
from a local scope to the global scope.
35+
The communication between the UI and the kernel (request - response) will have the
36+
structures described at
37+
https://jupyter-client.readthedocs.io/en/latest/messaging.html#copytoglobals.
38+
39+
- Request (from UI to kernel)
40+
41+
```python
42+
{
43+
'type': 'request',
44+
'command': 'copyToGlobals',
45+
'arguments': {
46+
# the variable to copy from the frame corresponding to `srcFrameId`
47+
'srcVariableName': str,
48+
'srcFrameId': int,
49+
# the copied variable name in the global scope
50+
'dstVariableName': str
51+
}
52+
}
53+
```
54+
55+
- Response (from kernel to UI)
56+
57+
```python
58+
{
59+
'type': 'response',
60+
'success': bool,
61+
'command': 'setExpression',
62+
'body': {
63+
# string representation of the copied variable
64+
'value': str,
65+
# type of the copied variable
66+
'type': str,
67+
'variablesReference': int
68+
}
69+
}

0 commit comments

Comments
 (0)