Skip to content

Name the Jupyter kernel after its pixi environment - #26

Merged
Marius1311 merged 1 commit into
mainfrom
fix/kernel-per-env
Oct 21, 2026
Merged

Marius1311 merged 1 commit into
mainfrom
fix/kernel-per-env

Conversation

@Marius1311

Copy link
Copy Markdown
Member

install-kernel registered every environment under the same kernel name, so pixi 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>-default and <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, plain pixi run install-kernel fails as ambiguous. Tested with pixi 0.82: $PIXI_ENVIRONMENT_NAME expands to default / 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

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-19T15:14:35.731542Z 634ebf8 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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)"'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Marius1311
Marius1311 merged commit f831971 into main Oct 21, 2026
1 check passed
@Marius1311
Marius1311 deleted the fix/kernel-per-env branch October 21, 2026 09:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant