Skip to main content

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

kunda-0.0.2.tar.gz (34.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kunda-0.0.2-py3-none-any.whl (29.3 kB view details)

Uploaded Python 3

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

Hashes for kunda-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e7c5bc2f185e7bd32ee7198536814c1c96320225f5d25e7b3245b82006de3439
MD5 a4652c51869c07ccc1ab58d48b4c3c6e
BLAKE2b-256 a98de8525ed6711da3c1155686071a7c9788cf36bba1b5ef5744551c3154a319

See more details on using hashes here.

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

Hashes for kunda-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b9520676cbb82da8a9c523edb111cf82c88478e8a0c93a40b2f8c81c7ed0d2e
MD5 ab8c2cd134b929a8d51a70711e91a260
BLAKE2b-256 9bfe20110d3c299852c734fc8f33e6565f992722f1a87e2e0ab368e3ff4d48f2

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page