@deepnote/convert

中文文档
5.0.0发布于 2026/11/05Apache-2.0TypeScriptESM + CJS近 30 天下载 8181

Bidirectional converter between Deepnote project files (.deepnote) and multiple notebook formats: Jupyter (.ipynb), Quarto (.qmd), Percent (.py), and Marimo (.py).

原始使用文档
文档目录15 节
  1. Installation
  2. Supported Formats
  3. CLI Usage
  4. Convert to Deepnote
  5. Convert from Deepnote
  6. Options
  7. Examples
  8. Python File Detection
  9. Lossless Roundtrip Conversion
  10. Platform Compatibility
  11. Programmatic Usage
  12. Convert to Deepnote
  13. Convert from Deepnote
  14. Pure Conversion (No File I/O)
  15. License

@deepnote/convert

Bidirectional converter between Deepnote project files (.deepnote) and multiple notebook formats: Jupyter (.ipynb), Quarto (.qmd), Percent (.py), and Marimo (.py).

# Convert any supported format to Deepnote
npx @deepnote/convert notebook.ipynb
npx @deepnote/convert document.qmd
npx @deepnote/convert notebook.py  # percent or marimo format

# Convert Deepnote to any supported format
npx @deepnote/convert project.deepnote                      # defaults to Jupyter
npx @deepnote/convert project.deepnote --outputFormat quarto
npx @deepnote/convert project.deepnote --outputFormat percent
npx @deepnote/convert project.deepnote --outputFormat marimo

Installation

npm install -g @deepnote/convert

Supported Formats

FormatExtensionDescription
Jupyter.ipynbStandard Jupyter Notebook JSON format
Quarto.qmdQuarto markdown documents with code chunks
Percent.pyPython files with # %% cell markers (VS Code, Spyder)
Marimo.pyMarimo reactive notebooks with @app.cell decorators

CLI Usage

The package provides a deepnote-convert command-line tool for bidirectional conversion.

Convert to Deepnote

Any supported format converts to .deepnote automatically:

# Single file
deepnote-convert notebook.ipynb
deepnote-convert document.qmd
deepnote-convert notebook.py  # auto-detects percent vs marimo

# Directory of files — one single-notebook .deepnote per notebook (into the dir, or use -o <dir>)
deepnote-convert path/to/notebooks/

Convert from Deepnote

Use --outputFormat to choose the target format (defaults to jupyter):

deepnote-convert project.deepnote                        # → Jupyter notebooks
deepnote-convert project.deepnote --outputFormat jupyter # → Jupyter notebooks
deepnote-convert project.deepnote --outputFormat quarto  # → Quarto documents
deepnote-convert project.deepnote --outputFormat percent # → Percent format files
deepnote-convert project.deepnote --outputFormat marimo  # → Marimo notebooks

Options

--projectName <name>

Set a custom name for the Deepnote project (when converting to .deepnote):

deepnote-convert notebook.ipynb --projectName "My Analysis"

-o, --outputPath <path>

Specify where to save the output:

# To Deepnote: Save to a specific file or directory
deepnote-convert notebook.ipynb -o output/project.deepnote
deepnote-convert notebook.ipynb -o output/

# From Deepnote: Specify output directory
deepnote-convert project.deepnote -o output/notebooks/

--outputFormat <format>

Choose output format when converting from .deepnote:

deepnote-convert project.deepnote --outputFormat quarto

Options: jupyter (default), quarto, percent, marimo

--singleFile

By default, when converting to Deepnote, cell outputs are split into a separate snapshot file under a snapshots/ directory beside the .deepnote, leaving the main file output-free. Pass --singleFile to inline the outputs into the single .deepnote and skip the snapshot:

deepnote-convert notebook.ipynb --singleFile

Examples

# Jupyter → Deepnote
deepnote-convert titanic.ipynb --projectName "Titanic Analysis"
deepnote-convert ./notebooks -o ./output

# Quarto → Deepnote
deepnote-convert analysis.qmd --projectName "Data Report"

# Percent → Deepnote (auto-detected from # %% markers)
deepnote-convert script.py

# Marimo → Deepnote (auto-detected from @app.cell decorators)
deepnote-convert reactive.py

# Deepnote → various formats
deepnote-convert project.deepnote                        # Jupyter (default)
deepnote-convert project.deepnote --outputFormat quarto  # Quarto
deepnote-convert project.deepnote --outputFormat percent # Percent
deepnote-convert project.deepnote --outputFormat marimo  # Marimo

Python File Detection

When converting .py files, the converter auto-detects the format:

  • Marimo: Contains import marimo and @app.cell decorators
  • Percent: Contains # %% cell markers

For directory scanning, use explicit naming:

  • *.marimo.py for Marimo files
  • *.percent.py for percent format files

Lossless Roundtrip Conversion

The converter supports lossless roundtrip conversions for Jupyter:

  • Deepnote → Jupyter → Deepnote: Preserves all Deepnote-specific metadata in Jupyter cell metadata
  • Jupyter → Deepnote → Jupyter: Preserves original Jupyter content while adding Deepnote metadata

Other formats (Quarto, Percent, Marimo) preserve content and structure but may not retain all Deepnote-specific metadata.

Platform Compatibility

Since Jupyter (.ipynb) is the standard format, notebooks from cloud platforms that use Jupyter are fully supported with metadata preservation:

PlatformStatusNotes
Google Colab✅ Fully compatiblePreserves Colab cell IDs, form cells, GPU settings
Amazon SageMaker✅ Fully compatiblePreserves tags, training/inference markers
Kaggle✅ Fully compatiblePreserves UUIDs, cell GUIDs, hide input/output
Azure ML Notebooks✅ Fully compatibleStandard Jupyter with Azure metadata
JupyterLab/Hub✅ Fully compatibleStandard Jupyter format

Platform-specific cell metadata is preserved during roundtrip conversion, allowing notebooks to be edited in Deepnote and exported back to the original platform without losing settings.

Programmatic Usage

Convert to Deepnote

import {
  convertIpynbFileToDeepnoteFile,
  convertQuartoFileToDeepnoteFile,
  convertPercentFileToDeepnoteFile,
  convertMarimoFileToDeepnoteFile,
} from "@deepnote/convert";

// Each call converts ONE source notebook into ONE single-notebook .deepnote file.

// From Jupyter
await convertIpynbFileToDeepnoteFile("notebook.ipynb", {
  outputPath: "output.deepnote",
  projectName: "My Project",
});

// From Quarto
await convertQuartoFileToDeepnoteFile("document.qmd", {
  outputPath: "output.deepnote",
  projectName: "My Project",
});

// From Percent
await convertPercentFileToDeepnoteFile("script.py", {
  outputPath: "output.deepnote",
  projectName: "My Project",
});

// From Marimo
await convertMarimoFileToDeepnoteFile("notebook.py", {
  outputPath: "output.deepnote",
  projectName: "My Project",
});

Convert from Deepnote

import {
  convertDeepnoteFileToJupyterFiles,
  convertDeepnoteFileToQuartoFiles,
  convertDeepnoteFileToPercentFiles,
  convertDeepnoteFileToMarimoFiles,
} from "@deepnote/convert";

// To Jupyter
await convertDeepnoteFileToJupyterFiles("project.deepnote", {
  outputDir: "./jupyter-notebooks",
});

// To Quarto
await convertDeepnoteFileToQuartoFiles("project.deepnote", {
  outputDir: "./quarto-docs",
});

// To Percent
await convertDeepnoteFileToPercentFiles("project.deepnote", {
  outputDir: "./percent-scripts",
});

// To Marimo
await convertDeepnoteFileToMarimoFiles("project.deepnote", {
  outputDir: "./marimo-notebooks",
});

Pure Conversion (No File I/O)

For programmatic use with in-memory data:

import fs from "node:fs/promises";
import { deserializeDeepnoteFile } from "@deepnote/blocks";
import {
  convertDeepnoteToJupyterNotebooks,
  convertDeepnoteToQuartoDocuments,
  convertDeepnoteToPercentNotebooks,
  convertDeepnoteToMarimoApps,
} from "@deepnote/convert";

// Read and deserialize the Deepnote file
const yamlContent = await fs.readFile("project.deepnote", "utf-8");
const deepnoteFile = deserializeDeepnoteFile(yamlContent);

// Convert to any format (pure functions, no I/O)
const jupyterNotebooks = convertDeepnoteToJupyterNotebooks(deepnoteFile);
const quartoDocuments = convertDeepnoteToQuartoDocuments(deepnoteFile);
const percentNotebooks = convertDeepnoteToPercentNotebooks(deepnoteFile);
const marimoApps = convertDeepnoteToMarimoApps(deepnoteFile);

// Work with the results in memory
for (const { filename, notebook } of jupyterNotebooks) {
  console.log(`${filename}: ${notebook.cells.length} cells`);
}

License

Apache-2.0

版本与发布记录

@deepnote/convert 共发布 24 个版本,首次发布于 2025/11/01;过去 12 个月发布了 21 个版本。

版本发布日期距今
5.0.0latest2026/11/056 天前
4.0.32026/10/1230 天前
4.0.22026/10/051 个月前
4.0.12026/08/132 个月前
4.0.02026/06/294 个月前
3.2.22026/03/267 个月前

关于 @deepnote/convert 的常见问题

@deepnote/convert 是什么?

Bidirectional converter between Deepnote project files (.deepnote) and multiple notebook formats: Jupyter (.ipynb), Quarto (.qmd), Percent (.py), and Marimo (.py).

如何安装 @deepnote/convert?

在项目目录运行 npm install @deepnote/convert,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 deepnote-convert,可以用 npx deepnote-convert 直接运行。

@deepnote/convert 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@deepnote/convert 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@deepnote/convert 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22.14.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@deepnote/convert 可以商用吗?

@deepnote/convert 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@deepnote/convert 的下载量有多少?

根据 npm 官方下载统计,@deepnote/convert 在 2026/10/12 – 2026/11/10 这 30 天内被下载 8,181 次,日均约 273 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@deepnote/convert 还在维护吗?

最新版本 5.0.0 发布于 2026/11/05(6 天前);至今共发布 24 个版本,其中过去 12 个月发布了 21 个;首次发布于 2025/11/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。