Skip to content

Route sandbox package changes through the script environment - #10696

Open
manzt wants to merge 1 commit into
sandbox-envsfrom
sandbox-packages
Open

Route sandbox package changes through the script environment#10696
manzt wants to merge 1 commit into
sandbox-envsfrom
sandbox-packages

Conversation

@manzt

@manzt manzt commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Installing a package into a sandboxed notebook runs uv pip install against the environment and edits the script metadata as a separate step. The install ignores the metadata's index configuration and sources (#6042), and the two steps can disagree.

This PR makes a package change edit the manifest and synchronize the environment, so uv owns constraint selection and resolves with the metadata's full semantics. uv's output streams to the frontend, and a resolution failure streams the solver's message instead of pointing at the terminal.

pm = create_package_manager("uv", script_path=notebook_path)
await pm.install("polars", version=None, log_callback=on_line)

Reconciling the complete manifest may also move shared transitive dependencies, matching what uv add --script does by hand.

Closes #6042

@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
marimo-docs Ready Ready Preview Aug 28, 2026 10:57pm

Request Review

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@manzt manzt added the bug Something isn't working label Aug 28, 2026
@manzt manzt changed the title sandbox packages Route sandbox package changes through the script environment Aug 28, 2026
@manzt
manzt force-pushed the sandbox-packages branch from 7ff0e9a to a10835c Compare August 28, 2026 22:28
@manzt
manzt force-pushed the sandbox-packages branch from a10835c to 3429bc7 Compare August 28, 2026 22:38
Installing a package into a sandboxed notebook runs `uv pip install`
against the environment and then edits the script metadata as a separate
step. The install ignores the metadata's index configuration and sources
(#6042), the two steps can disagree, and the server infers "sandboxed"
from the metadata-management flag, which also covers configured venvs.

These changes put uv's package manager in script mode when the notebook's
dependencies live in a script environment. Installs and uninstalls edit
the manifest and synchronize the environment, so uv owns constraint
selection and resolves with the metadata's full semantics. uv's output
streams to the frontend line by line, and a resolution failure streams
the solver's message instead of pointing at the terminal.

```py
pm = create_package_manager("uv", script_path=notebook_path)
await pm.install("polars", version=None, log_callback=on_line)
```

`MARIMO_SANDBOX_MODE` carries the sandbox identity explicitly: the
single-file launcher and multi-file kernels set it, configured venvs do
not, and the server keys script mode on the kernel's synchronized
environment rather than on metadata management. Cell-registration
namespace updates keep their metadata-only path; explicit installs no
longer write the metadata twice.

Closes #6042
@manzt
manzt force-pushed the sandbox-packages branch from 3429bc7 to 86b14ad Compare August 28, 2026 22:56
@manzt
manzt marked this pull request as ready for review August 29, 2026 18:41
Copilot AI lite review requested due to automatic review settings August 29, 2026 18:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PackageManager's are ignoring index-url's when listing packages

2 participants