Kunda
Install
pip install kunda
Select an interpreter
from kunda import python_for, find_pythons, venv_env
python_for('~/code/myrepo/src', stop='~/code/myrepo')
find_pythons(roots=['~/code'], current=...)
venv_env(python)
python_for searches parent folders up to stop. It then uses the supplied default or a virtual environment under roots. None means the current interpreter.
venv_env removes frozen-host interpreter variables before starting the child.
Run one kernel
from kunda import Kernel
k = Kernel(cwd='~/code/myrepo', python=..., kernel='ipymini')
await k.start()
out = await k.execute('df.head()', on_output=print)
out.ok, out.text, out.execution_count
await k.complete('df.he', 5)
await k.restart()
await k.shutdown()
ExecOutcome contains execution errors and leaves the kernel available. missing_kernel_module reports a missing launcher after startup fails. Local kernels use jupyter_client; gateway kernels use the same interface over WebSocket.
Keep several kernels alive
from kunda import KernelPool, RuntimeBroker
pool = KernelPool(broker=RuntimeBroker(max_kernels=12), idle=30*60)
k = await pool.get('notebook-1', cwd=..., python=..., inspect=True)
pool.peek('notebook-1')
await pool.close('notebook-1')
await pool.close_all()
Each key has at most one kernel. The pool discards failed starts and keeps busy kernels. idle=0 disables reaping.
RuntimeBroker enforces a process-wide limit. A host can also provide runners and known kernelspecs for other languages.
KernelPool(runner_for=lambda lang: MyRustRunner if lang == 'rust' else None,
known_kernels={'julia': 'julia-1.10'})
Install kernel support
from kunda import kernel_support, install_kernel_support, installable
kernel_support(python)
installable(python)
install_kernel_support(python)
Installation uses the host’s installed package versions. It fails when either launcher still cannot import.
Inspect live variables
With inspect=True, Kunda starts Dhrishti inside the kernel and reads its registry. A matching Python minor version uses the host package. Other versions use the project installation.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 kunda-0.0.2.tar.gz.
File metadata
- Download URL: kunda-0.0.2.tar.gz
- Upload date:
- Size: 34.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7c5bc2f185e7bd32ee7198536814c1c96320225f5d25e7b3245b82006de3439
|
|
| MD5 |
a4652c51869c07ccc1ab58d48b4c3c6e
|
|
| BLAKE2b-256 |
a98de8525ed6711da3c1155686071a7c9788cf36bba1b5ef5744551c3154a319
|
File details
Details for the file kunda-0.0.2-py3-none-any.whl.
File metadata
- Download URL: kunda-0.0.2-py3-none-any.whl
- Upload date:
- Size: 29.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b9520676cbb82da8a9c523edb111cf82c88478e8a0c93a40b2f8c81c7ed0d2e
|
|
| MD5 |
ab8c2cd134b929a8d51a70711e91a260
|
|
| BLAKE2b-256 |
9bfe20110d3c299852c734fc8f33e6565f992722f1a87e2e0ab368e3ff4d48f2
|