Skip to main content

Module kernelspec

Module kernelspec 

Source
Expand description

Per-repository kernelspecs: the only stock-jupyter channel for a per-kernel WARATAH_REPO.

jupyter-server 2.21 (see python/requirements.lock) has no kernel env allowlist — request-supplied env is dropped by the API handlers and no trait re-enables it (that is a jupyter-enterprise-gateway feature the work order assumed existed; verified absent against the pin). What stock jupyter does support:

  • kernels inherit the sidecar process environment (covers WARATAH_URL and the default WARATAH_REPO), and
  • a kernelspec’s env stanza is applied over the inherited environment at kernel launch (jupyter_client pre_launch: env.update(...)).

So the engine writes one spec per repository — {runtime_dir}/kernels/python3-{repo}/kernel.json with "env": {"WARATAH_REPO": repo} — and discovers them by putting {runtime_dir} on the sidecar’s JUPYTER_PATH. The proxy turns the UI’s per-request env.WARATAH_REPO into that kernelspec name (waratah_notebook::proxy), keeping the documented UI contract working on a stack without request-env support.

Functions§

kernel_spec_name
Kernelspec name for one Waratah repository.
valid_repo_id
Repository ids are the engine’s MAIN_REPOSITORY_ID-style ids; keep them filesystem-safe because they become kernelspec directory names.
write_spec
Write the kernelspec for repo under {runtime_dir}/kernels/.