Aner in Jupyter
Install the optional native Aner kernel and inspect completed cells, typed variables, reference diagrams, and separate training loss curves in real Jupyter notebooks.
This optional Python package connects a real Jupyter .ipynb notebook to the native Aner interpreter. Aner code executes in the C++ process. Python supplies only Jupyter messaging and read only HTML/SVG views of native observations.
Requires Python 3.10 or newer, ipykernel 6.29 to 7.x, jupyter client 8.x, and an updated Aner binary supporting aner session --stdio --dev-protocol. The installer writes a kernelspec; it does not install or compile the interpreter.
Install in your Jupyter environment
From the Aner project root, with the Python environment used by Jupyter active:
python -m pip install ./tools/jupyter
python -m aner_kernel.install --user --executable /absolute/path/to/anerUse --sys-prefix instead of --user for environment local registration. An existing kernel name is left alone unless --replace is explicitly given. --name chooses a different name. The kernelspec pins this Python interpreter and, when supplied, the native executable path. Otherwise the kernel looks for ANER_EXECUTABLE, then aner on PATH, then a development checkout's debug binary.
Select the Aner kernel and open examples/jupyter/development_nn.ipynb. Imports and variables persist across cells. Function/class redefinition follows the native notebook rules: restart before redefining a class/function. Each source request is limited to 1 MiB, with a 120 second timeout including startup, writing, and execution. Interrupting or a transport failure terminates the owned native process and clears variables.
Modes and observations
Production is the default. Put a control in its own cell:
| Control | Meaning |
|---|---|
%aner dev | Enable bounded native development observations, then clear the prior session. |
%aner dev values | Additionally enable bounded raw tensor/gradient exports. |
%aner prod | Disable observations and clear the prior session. |
%aner variables | Display the last known observation without running Aner code. |
%aner reset | Clear native variables and observation state, retaining the selected mode. |
Rerun setup after mode changes. Removing the Dev control requires restarting the kernel to restore the default Prod mode. Saved outputs are historical; they are not a saved native heap or model checkpoint. Static failures preserve state, runtime failures clear state, and pre reset observations are explicitly labeled historical.
Development output includes typed variables with exact Int64 text, collection/object previews and reference diagrams, per fit loss curves, capture phase labels, and an operation topology summary. It is produced after cells complete, not streamed during execution. Full recorded neuron/dependency/gradient inspection remains available in the standalone CLI training report. The kernel does not claim Jupyter debugger support, edit values, or evaluate inspection expressions.
Validation
ANER_TEST_EXECUTABLE=/absolute/path/to/aner PYTHONPATH=tools/jupyter python -m unittest discover -s tests -p jupyter_tests.pyTests cover exact byte framing, Unicode, outputs resembling headers, bounded JSON, blocked and partial writes, timeouts, cyclic graphs, HTML escaping, large integers, and native state/training lifecycle. For the real Jupyter integration test, install nbclient and nbformat in the test environment, register its Aner kernel, then run python tests/jupyter_e2e.py --kernel aner. It executes the clean example and checks native development MIME observations, production output, and failure/reset behavior.
Architecture follows Jupyter's wrapper kernel interface. See the Aner mode guide for CLI/editor workflows and model checkpoint APIs.