From 2cc1736a5a437bd3a74fa1501dbd3fdd62287af3 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Mon, 20 Feb 2023 11:01:17 +0100 Subject: [PATCH 1/4] JEP for copy-to-globals support in debugger_info --- .../debugger-info-copy-to-globals.md | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 debugger-info-copy-to-globals/debugger-info-copy-to-globals.md diff --git a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md new file mode 100644 index 00000000..3d813665 --- /dev/null +++ b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md @@ -0,0 +1,25 @@ +--- +title: Debugger support to copyToGlobals +authors: Nicolas Brichet (@brichet) +issue-number: xxx +pr-number: xxx +date-started: 2023-02-20 +--- + +# Summary + +This JEP introduces a new field to the kernel debugger_info response. This new +field will inform the UI that the debugger supports the `copyToGlobals` request. + +# Motivation + +The `copyToGlobals` request has been introduced in +[ipykernel](https://github.com/ipython/ipykernel/pull/1055) and in +[xeus-python](https://github.com/jupyter-xeus/xeus-python/pull/562) to copy a local +variable to the global scope during a breakpoint. It would be useful to inform the +UI if this is supported by the kernel before displaying the corresponding menu entry. + +# Proposed Enhancement + +We propose to add a new `copyToGlobals` boolean field to the `debugger_info` +response which will inform the UI that this request is supported. From cadd4651dda88ba78075d28f840b16131af10ad5 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet Date: Tue, 21 Nov 2023 16:46:24 +0100 Subject: [PATCH 2/4] Add requests description --- .../debugger-info-copy-to-globals.md | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md index 3d813665..5530d71c 100644 --- a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md +++ b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md @@ -23,3 +23,47 @@ UI if this is supported by the kernel before displaying the corresponding menu e We propose to add a new `copyToGlobals` boolean field to the `debugger_info` response which will inform the UI that this request is supported. + +## Reference-level explanation + +This boolean flag should be included in the `debugger_info` response from the kernel +which supports the feature. It is optional, assuming that its absence is understood +as `false` from the client perspective. + +If the feature is supported, the kernel must provide a function for copying a variable +from a local scope to the global scope. +The communication between the UI and the kernel (request - response) will have the +structures described at +https://jupyter-client.readthedocs.io/en/latest/messaging.html#copytoglobals. + +- Request (from UI to kernel) + + ```json + { + 'type': 'request', + 'command': 'copyToGlobals', + 'arguments': { + # the variable to copy from the frame corresponding to `srcFrameId` + 'srcVariableName': str, + 'srcFrameId': int, + # the copied variable name in the global scope + 'dstVariableName': str + } + } + ``` + +- Response (from kernel to UI) + + ```json + { + 'type': 'response', + 'success': bool, + 'command': 'setExpression', + 'body': { + # string representation of the copied variable + 'value': str, + # type of the copied variable + 'type': str, + 'variablesReference': int + } + } From 16ef933880995ddb8f04163a81f3a4d4096f1e6f Mon Sep 17 00:00:00 2001 From: Nicolas Brichet <32258950+brichet@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:26:17 +0100 Subject: [PATCH 3/4] Update debugger-info-copy-to-globals/debugger-info-copy-to-globals.md Co-authored-by: gabalafou --- debugger-info-copy-to-globals/debugger-info-copy-to-globals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md index 5530d71c..d5c651ce 100644 --- a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md +++ b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md @@ -38,7 +38,7 @@ https://jupyter-client.readthedocs.io/en/latest/messaging.html#copytoglobals. - Request (from UI to kernel) - ```json + ```python { 'type': 'request', 'command': 'copyToGlobals', From 109c920aed567b0b247ff63fdfec2d543628ffd1 Mon Sep 17 00:00:00 2001 From: Nicolas Brichet <32258950+brichet@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:26:22 +0100 Subject: [PATCH 4/4] Update debugger-info-copy-to-globals/debugger-info-copy-to-globals.md Co-authored-by: gabalafou --- debugger-info-copy-to-globals/debugger-info-copy-to-globals.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md index d5c651ce..fafd4a3c 100644 --- a/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md +++ b/debugger-info-copy-to-globals/debugger-info-copy-to-globals.md @@ -54,7 +54,7 @@ https://jupyter-client.readthedocs.io/en/latest/messaging.html#copytoglobals. - Response (from kernel to UI) - ```json + ```python { 'type': 'response', 'success': bool,