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.
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.
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.