Skip to content

fix: --sandbox flag should add script metadata when none exists#7954

Merged
akshayka merged 6 commits intomainfrom
aka/fix-always-add-script-metadata
Jan 23, 2026
Merged

fix: --sandbox flag should add script metadata when none exists#7954
akshayka merged 6 commits intomainfrom
aka/fix-always-add-script-metadata

Conversation

@akshayka
Copy link
Contributor

When using marimo edit --sandbox notebook.py on a file without PEP 723 script metadata, the marimo dependency and Python version were not being added. This caused uv run notebook.py to fail because marimo wasn't declared as a dependency.

Now _ensure_marimo_in_script_metadata() will:

  • Create the script metadata block if it doesn't exist
  • Add requires-python with the current Python version
  • Add marimo as a dependency

Also ensures requires-python is added when marimo is already present but the Python version is missing.

When using `marimo edit --sandbox notebook.py` on a file without PEP 723
script metadata, the marimo dependency and Python version were not being
added. This caused `uv run notebook.py` to fail because marimo wasn't
declared as a dependency.

Now `_ensure_marimo_in_script_metadata()` will:

- Create the script metadata block if it doesn't exist
- Add `requires-python` with the current Python version
- Add marimo as a dependency

Also ensures `requires-python` is added when marimo is already present
but the Python version is missing.
@vercel
Copy link

vercel bot commented Jan 23, 2026

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

Project Deployment Review Updated (UTC)
marimo-docs Ready Ready Preview, Comment Jan 23, 2026 11:26pm

Request Review

@akshayka akshayka requested a review from koaning January 23, 2026 18:05
@akshayka akshayka added the bug Something isn't working label Jan 23, 2026
…o-team/marimo into aka/fix-always-add-script-metadata
@akshayka akshayka merged commit a8c7120 into main Jan 23, 2026
49 of 50 checks passed
@akshayka akshayka deleted the aka/fix-always-add-script-metadata branch January 23, 2026 23:55
@github-actions
Copy link

🚀 Development release published. You may be able to view the changes at https://marimo.app?v=0.19.6-dev6

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.

2 participants