Jupyter kernel for Kiwi.
Project description
Kiwi Jupyter Kernel
kiwi-array-jupyter is a Jupyter kernel for Kiwi that takes the direct-bridge
route:
- Jupyter runs a small Python
ipykernelhost - the Python host loads the local Kiwi C ABI bridge with
ctypes - the bridge owns a persistent Kiwi
Session - the bridge and
Sessioncome from the Kiwi source checkout or the packaged wheel payload
This deliberately avoids the JSON REPL transport. The kernel boundary is:
Jupyter
-> ipykernel
-> ctypes
-> libkiwi_bridge
-> Kiwi Session
-> MLX
What Is Here
build.zig: small Zig regression target wired against../../implementations/kiwi-zig-main/src/kiwi_bridge.zig../../implementations/kiwi-zig-main/bridge/include/kiwi_bridge.h: shared C ABI for persistent Kiwi sessions../../implementations/kiwi-zig-main/python/runtime/src/kiwi_array/bridge.py: main-owned Python bridge wrapper consumed by this kernelzig-src/tests.zig: focused bridge regression testspyproject.toml: editable Python package for the kernel hostsrc/kiwi_array_jupyter_kernel/binding.py: thin re-export of the main-owned Python bridge wrappersrc/kiwi_array_jupyter_kernel/execution.py: notebook cell execution helperssrc/kiwi_array_jupyter_kernel/kernel.py:ipykernelintegrationsrc/kiwi_array_jupyter_kernel/install.py: bridge build plus kernelspec install helpersrc/kiwi_array_jupyter_kernel/assets/kernel-logo.png: vendored kernelspec logo source used for Jupyter icon files
Current Scope
This first cut is intentionally narrow:
- execution is direct and stateful
- cells run line-by-line using the same blank-line and full-line-comment rules as script mode
- assignments suppress output
- echoed results surface in the notebook
- JSON strings that carry a Vega-Lite schema also surface as Vega-Lite MIME data
- completion and
inspectcover the current built-in named functions - delimiter-only
is_completedistinguishes incomplete from clearly invalid input
It does not yet try to provide:
- general structured array display beyond
text/plain - parser-aware completeness checks
- full symbol completion from live session state
- a native Zig Jupyter wire-protocol implementation
Build And Install
From the Kiwi repository root:
cd extensions/jupyter-kiwi
uv python install --managed-python 3.14.2
uv sync --managed-python --python 3.14.2 --group dev
uv run --managed-python python -m kiwi_array_jupyter_kernel.install --user
In a fresh public checkout, bootstrap MLX first from the Kiwi root with
KIWI_MLX_BACKEND=cpu scripts/bootstrap_deps.sh unless .deps/mlx and
.deps/mlx-c already exist.
The install helper builds the official bridge in ../../implementations/kiwi-zig-main/zig-out/lib if needed.
The installed library is:
../../implementations/kiwi-zig-main/zig-out/lib/libkiwi_bridge.dylibon macOS../../implementations/kiwi-zig-main/zig-out/lib/libkiwi_bridge.soon Linux
The install helper writes a kernelspec that launches:
python -m kiwi_array_jupyter_kernel -f {connection_file}
When the bridge has already been built, the kernelspec also captures the
absolute KIWI_BRIDGE_LIB path so notebook startup does not depend on
accidentally finding the right local library at runtime.
Tests
From this directory:
uv run --managed-python pytest tests/test_kiwi_jupyter_kernel.py
zig build test
From the repository root, make test-jupyter runs the Python Jupyter kernel
tests when that target is available.
Notes
- The pinned dev interpreter is the uv-managed CPython
3.14.2patch release tracked in.python-version. - The
devdependency group includes the Python test stack for the kernel host plusjupyter_kernel_testfor end-to-end kernel validation work. - The kernelspec logo is sourced from the vendored
src/kiwi_array_jupyter_kernel/assets/kernel-logo.png, derived from the current website favicon artwork instead of depending on generated website output. - The loader looks for packaged wheel libraries first and then
../../implementations/kiwi-zig-main/zig-out/libin source checkouts. - Set
KIWI_BRIDGE_LIBto override the bridge path. KIWI_JUPYTER_BRIDGE_LIBis still accepted as a compatibility alias.- Set
KIWI_MLX_PREFIXandKIWI_MLX_C_INCLUDEto override the MLX link inputs when building the bridge from Python. - Set
KIWI_JUPYTER_DEVICE=cpuorgputo pin the default MLX device.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kiwi_array_jupyter-0.2.49-py3-none-any.whl.
File metadata
- Download URL: kiwi_array_jupyter-0.2.49-py3-none-any.whl
- Upload date:
- Size: 47.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
322902a6ab7fa303a724e2a8c1fc7c36936a761864cfe1c57857826d19085aee
|
|
| MD5 |
e91e1ac032a1a90608ff1802c0d3b20a
|
|
| BLAKE2b-256 |
be9b73f5b11f9191a9df1cb758714a136340f06c301f4f7fc713e0e16663dfd4
|