Repository navigation
Name the Jupyter kernel after its pixi environment - #26
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 634ebf832f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| lab = "jupyter lab" | ||
| test = "pytest" | ||
| install-kernel = "python -m ipykernel install --user --name={{ cookiecutter.project_name }} --display-name='{{ cookiecutter.project_name }} (pixi)'" | ||
| install-kernel = 'python -m ipykernel install --user --name={{ cookiecutter.project_name }}-$PIXI_ENVIRONMENT_NAME --display-name="{{ cookiecutter.project_name }} (pixi, $PIXI_ENVIRONMENT_NAME)"' |
There was a problem hiding this comment.
Preserve compatibility for project-owned notebook kernels
For existing projects that apply this through cruft update, only pixi.toml receives the renamed kernel because pyproject.toml:91-93 explicitly excludes README.md and analysis/ from updates. On a fresh machine, install-kernel therefore registers <project>-default while every existing project-owned notebook still requests <project>, leaving Jupyter unable to resolve its kernelspec without manual reselection. Preserve the old default-environment alias or provide a migration that can update those skipped notebooks.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not fixing. On machines that already have the old kernel it stays registered, so existing notebooks keep working there. On a fresh machine, Jupyter asks once per notebook to pick a kernel, and the notebook then stores the new name. Keeping the old name for the default environment would need per-environment activation variables, because pixi's task shell has no conditionals. That's more config in every project than a one-time kernel pick is worth.
install-kernelregistered every environment under the same kernel name, sopixi run -e gpu install-kernel, as the README suggests, replaced the default environment's kernel. The task now names the kernel after its pixi environment:<project>-defaultand<project>-gpu, shown as<project> (pixi, default)and<project> (pixi, gpu). The README and the demo notebook's kernelspec follow.A single task rather than a
[feature.gpu.tasks]override: with a task of the same name in two environments, plainpixi run install-kernelfails as ambiguous. Tested with pixi 0.82:$PIXI_ENVIRONMENT_NAMEexpands todefault/gpu, and the quoted display name stays one argument.An existing project's kernel registered under the old name stays in place; delete it with
jupyter kernelspec remove <project>.🤖 Generated with Claude Code