Файли
openidea/fixtures/python-app/notebooks/variables.ipynb
T
LU XIANGRUIтаwildcatDownstairs 4ff5739854 feat(notebook): show the running kernel's variables in a Jupyter Variables tool window (#6517)
A Jupyter Variables tool window (bottom, under the stripe's overflow until first opened; also in Find Action) lists the variables of the last active notebook's kernel: name, type and a truncated repr, hiding private names, modules and IPython's own names. It refreshes after a run, a kernel restart and a switch of notebook, and never starts a kernel.

The variables are read with a silent execute_request carrying a user expression (no output, history, execution count or busy/idle status), only while the kernel is idle; a run started meanwhile waits for it, bounded to 10 seconds. A notebook tab restored at startup picks up its session once it opens.

Closes #6508

Co-authored-by: wildcatDownstairs <[email protected]>
2026-11-27 23:02:19 +08:00

68 рядки
1.2 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"id": "cell-0",
"metadata": {},
"source": [
"# Kernel variables\n",
"\n",
"Run the cells, then open **Jupyter Variables**."
]
},
{
"cell_type": "code",
"id": "cell-1",
"metadata": {},
"source": [
"import json\n",
"\n",
"tasks = [\"write\", \"review\", \"ship\"]\n",
"done = {\"write\": True, \"review\": False}\n",
"_scratch = \"hidden: starts with _\""
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"id": "cell-2",
"metadata": {},
"source": [
"class Broken:\n",
" def __repr__(self):\n",
" raise RuntimeError(\"no repr\")\n",
"\n",
"\n",
"broken = Broken()\n",
"long_text = \"x\" * 500"
],
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"id": "cell-3",
"metadata": {},
"source": [
"count = len(tasks)\n",
"count"
],
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"name": "python"
}
},
"nbformat": 4,
"nbformat_minor": 5
}