Jupyter To Marimo

作者 marimo-team6454470960d3無授權條款174 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫7 週前更新

Convert a Jupyter notebook (.ipynb) to a marimo notebook (.py).

AI 產生的概覽

將 Jupyter 筆記本(.ipynb)轉換為 marimo 筆記本(.py)並審查結果。

功能
引導代理使用 marimo convert 指令把 Jupyter 筆記本轉換成 marimo 筆記本,接著審查並驗證產生的 Python 檔案。內容涵蓋套件中繼資料、儲存格編排、magic 指令、介面控制項、耗時工作的攔阻以及機密處理,並附上有關小工具與 LaTeX 的參考檔案。最終產出是整理過的 marimo 筆記本,並透過 marimo check 驗證。
適用情境
當需要把 Jupyter 筆記本遷移或移植到 marimo 時使用。也適合用來審查或修正已轉換的 marimo 筆記本,檢查其正確性、呈現方式與互動行為。
執行需求
需要 uv/uvx 工具來執行 marimo convert 與 marimo check,並能存取來源 .ipynb 檔案。不附帶指令碼,僅為說明文件,另有两份關於小工具與 LaTeX 的參考文件。

Converting Jupyter Notebooks to Marimo

Convert first

Important: Run the converter before you read the source notebook:

bash
uvx marimo convert <notebook.ipynb> -o <notebook.py>

Read the .ipynb file only if conversion fails or the generated file omits required information. Treat the generated file as a first draft.

Run this command after conversion and after substantial edits:

bash
uvx marimo check <notebook.py>

Review the conversion

  • Verify all required packages in the PEP 723 metadata. The converter can miss some package-installation forms.
  • Remove residual installation cells and stale installation prose. Add version constraints only when required.
  • Use --sandbox when a notebook uses PEP 723 metadata.
  • Preserve the purpose and intended workflow of the source notebook.
  • Arrange cells for presentation. marimo determines execution order from variable definitions and references.
  • A cell can appear before a cell that defines its input.
  • Merge or split cells when the current boundaries reduce clarity.
  • Remove redundant Jupyter artifacts, such as unnecessary display() calls.
  • Review converted magic commands. Keep valid conversions, and resolve comments that report unsupported magics.
  • Put the value to render in the final expression of each cell.
  • Keep added UI and helper functions proportional to the notebook purpose.
  • Replace interactive input methods that wait for terminal input or do not work in the target interface. Use suitable UI controls, script parameters, or environment values.
  • Do not print, log, or save secrets. Consider EnvConfig for multiple environment values.
  • Identify expensive work and external side effects. If work must wait, gate it with mo.stop() and a suitable UI element.
  • Use a form if the user must submit multiple values together.
  • Define downstream values after the gate so the dependency graph defers dependent cells.
  • Present useful results with simple native components. Add live refresh only when the intended workflow requires it.
  • For ipywidgets, read references/widgets.md [blocked].
  • For LaTeX and MathJax, read references/latex.md [blocked].

Validate the result

  • Run marimo check again after all edits.
  • Run the notebook in each intended mode. Confirm that it has the intended behavior.
  • When practical, open the source and converted notebooks side by side and invite the user to review.
  • Compare content, controls, outputs, and workflow. Cell order and layout can differ.
  • Inspect changed files for secrets, generated data, caches, logs, and other runtime files.

來源與署名

來源:marimo-team/skills位於skills/jupyter-to-marimo提交6454470

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架