Skip to main content

Kunda

Install

pip install kunda

Select an interpreter

python_for searches parent folders up to stop, then uses the supplied default. When it finds nothing, it returns None and the host runs on its own Python. It never takes a venv from another folder in roots unless the caller sets borrow=True. venv_env prepares the child’s environment.

selected = python_for(root/'src', stop=root)
choices = find_pythons(roots=[root], current=selected)
environment = venv_env(selected, env={'PATH': '/usr/bin'})
Path(selected).relative_to(root), [row['label'] for row in choices], environment['VIRTUAL_ENV']
(Path('.venv/bin/python'),
 ['this one', 'tmps35syx1f/.venv', 'python3 on PATH', 'python on PATH'],
 '/private/var/folders/kg/9vdw4mdd1fs58svgh4k1qhr09x7dqh/T/tmps35syx1f/.venv')

Run one kernel

Execution errors are returned in ExecOutcome and leave the kernel available.

kernel = Kernel(cwd=root, inspect=True)
await kernel.start()
outcome = await kernel.execute('value = 21 * 2; value')
completion = await kernel.complete('val', 3)
outcome.ok, outcome.text, completion['matches'][:3]
(True, '42', ['value'])

Keep several kernels alive

Each key has at most one kernel. RuntimeBroker enforces a process-wide limit, and idle=0 disables reaping.

class RustRunner: pass

broker = RuntimeBroker(max_kernels=12)
pool = KernelPool(broker=broker, idle=0,
                  runner_for=lambda lang: RustRunner if lang == 'rust' else None,
                  known_kernels={'julia': 'julia-1.10'})
broker.status(), pool._class_for({'lang': 'rust'}).__name__
({'live': 0, 'limit': 12, 'runtimes': []}, 'RustRunner')

Kernel support

Support probes do not install packages. Installation uses the host’s installed package versions. make_venv(folder) gives a project its own .venv with kernel support, so a project without one does not borrow another environment.

support = kernel_support(python)
{k: v['available'] for k, v in support.items()}, installable(python)
({'ipykernel': False, 'ipymini': False}, True)

Inspect live variables

With inspect=True, Kunda starts Dhrishti inside the kernel and reads its registry.

await kernel.execute('visible_value = 42')
'name' in (await kernel.names()), 'visible_value' in (await kernel.names())
(False, True)

Build a host on Kunda

A host that starts its own helper processes asks Kunda the same questions a kernel does. runtime_python names the interpreter to spawn, which inside a frozen app is the bundled helper, and frozen_pythonpath gives the module paths that helper needs. kernel_spec builds the kernelspec from the host’s own table of languages. venv_roots lists the folders searched for a project’s environment. A host’s runner subclasses InspectorClient for the inspector calls and idle clock, and give_up_after bounds any close that might not answer. Each of these had a leading underscore before 0.0.4, and the old names still work.

Metadata

Release files for kunda 0.0.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kunda 0.0.14
File Size Uploaded Provenance Actions
kunda-0.0.14.tar.gz 52.7 kB Without provenance Details for kunda-0.0.14.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kunda 0.0.14
File Interpreter ABI Platform Actions
kunda-0.0.14-py3-none-any.whl Python 3 none any Details for kunda-0.0.14-py3-none-any.whl

Total release size: 91.1 kB

Release files / kunda-0.0.14.tar.gz

Download URL kunda-0.0.14.tar.gz
Size 52.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dfa37beba9d73c971faf409f3fce3c27bde63e22e07ef23e6257778a0606d731
BLAKE2b-256 checksum
How to use checksums
46b45a29a4fda3832466abe194f9aed6b409e4b4c8e02aa6e57aed5ce2671d3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / kunda-0.0.14-py3-none-any.whl

Download URL kunda-0.0.14-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c07d42496be50e099d0cb06bbe5bdcb3e09374dce9b14df193813cd9a08b764e
BLAKE2b-256 checksum
How to use checksums
ae08c92bcbdccb211f3c799825298521c132ac6dcd08b33be8de5b6a8f805fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for kunda 0.0.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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