python_for searches parent folders up to stop, then uses the supplied default or a virtual environment under roots. 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.