-
Notifications
You must be signed in to change notification settings - Fork 857
feat: sandboxed home #7702
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: sandboxed home #7702
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
akshayka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Before releasing this feature, we should make sure the UX issues you alluded to in the PR description, in particular when the frontend handles the case in which sandbox notebooks fail to start (e.g., uv sync fails):
- the error should be communicated to the user;
- we should either fail fast (show the error and stop trying to connect to the kernel), or provide a way for the user to fix the error and try again (edit script metadata, then click a button to try creating the venv again)
If you prefer to work in multiple PRs, sandbox home could be feature flagged until the FE handles the failure case
akshayka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shutting down the server on the frontend should also shutdown running notebooks, but that does not appear to be happening right now
Co-authored-by: Akshay Agrawal <akshay@marimo.io>
for more information, see https://pre-commit.ci
21daf2d to
facafd6
Compare
| case "interrupted": | ||
| return; | ||
|
|
||
| case "kernel-startup-error": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we just re-use the generic "banner" notification? less code and more consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think it needs to be more visually - "this will not work"
| # Check for pyzmq dependency | ||
| from marimo._dependencies.dependencies import DependencyManager | ||
|
|
||
| if not DependencyManager.has("zmq"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DependencyManager.zmq.has()?
| action: Optional[Literal["restart"]] = None | ||
|
|
||
|
|
||
| class KernelStartupErrorNotification(Notification, tag="kernel-startup-error"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have StartupLog and Banner (which can be used for errors). i wonder if that might be better to piggy back off
| KernelStartupErrorNotification(error=error_message) | ||
| ) | ||
| text = f'{{"op": "kernel-startup-error", "data": {msg.decode("utf-8")}}}' | ||
| await self.websocket.send_text(text) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.session.notify( KernelStartupErrorNotification(error=error_message))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh maybe you don't have the session? this bit feels fragile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Changing this up, an advantage to having a session is that we could potentially stream the errors/ startup before closing. Will keep that for a future PR because this is quiet long, but will do the non-blocking kernel launch
| asset_url=asset_url, | ||
| timeout=timeout, | ||
| sandbox_mode=sandbox_mode, | ||
| home_sandbox_mode=home_sandbox, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- are these mutually exclusive? should we combine into a single flag?
home_sandbox_modefeels like it may become a misnomer quite soon. should it besandbox_mode: "none" | "single" | "multi"?
akshayka
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might not be related to this change, but I created a new notebook and marimo was not added to its script metadata:
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "matplotlib==3.10.8",
# ]
# ///Additionally, I am finding a bad interaction with format on save, see video:
ruff-install.mp4
| The kernel failed to start. This usually happens when there's an | ||
| issue with the sandbox environment or missing dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| The kernel failed to start. This usually happens when there's an | |
| issue with the sandbox environment or missing dependencies. | |
| The kernel failed to start. This usually happens when the package manager | |
| can't install your notebook's dependencies. |
📝 Summary
Adds
--sandboxtomarimo edit --sandbox directory/. Leveraging pep-723 where ever it can.closes #2598 rebases and supercedes #7640
marimo edit --sandbox(home mode)UX changes on kernel launch failure: