Set `UV_PYTHON` in Jupyter kernels (#11155)

## Summary

It turns out activating the kernel does not change `VIRTUAL_ENV`, so we
still install into the environment the Jupyter environment, rather than
the project environment.

Unfortunately, after this change, we do still show a warning on `uv
add`:

```
warning: `VIRTUAL_ENV=/Users/crmarsh/.cache/uv/archive-v0/3bddKDdYXuX2w57Fu6itL` does not match the project environment path `.venv` and will be ignored
```

`uv pip install` works without warning.

Closes #11154.
This commit is contained in:
Charlie Marsh 2025-02-01 16:54:34 -05:00 committed by GitHub
parent b0e9781da4
commit 2dfeafbaa4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 1 deletions

View File

@ -51,7 +51,7 @@ $ uv add --dev ipykernel
Then, you can create the kernel for `project` with:
```console
$ uv run ipython kernel install --user --name=project
$ uv run ipython kernel install --user --env VIRTUAL_ENV $(pwd)/.venv --name=project
```
From there, start the server with: