MCPcopy
hub / github.com/deepnote/deepnote / convertFromDeepnote

Function convertFromDeepnote

packages/cli/src/commands/convert.ts:134–178  ·  view source on GitHub ↗
(
  absolutePath: string,
  outputFormat: string,
  options: ConvertOptions
)

Source from the content-addressed store, hash-verified

132}
133
134async function convertFromDeepnote(
135 absolutePath: string,
136 outputFormat: string,
137 options: ConvertOptions
138): Promise<ConvertResult> {
139 if (!isSourceNotebookFormat(outputFormat)) {
140 throw new Error(
141 `Invalid output format: "${outputFormat}". Supported formats are: ${SOURCE_NOTEBOOK_FORMATS.join(', ')}`
142 )
143 }
144
145 const formatNames: Record<SourceNotebookFormat, string> = {
146 jupyter: 'Jupyter Notebooks',
147 percent: 'percent format files',
148 quarto: 'Quarto documents',
149 marimo: 'Marimo notebooks',
150 }
151
152 const quiet = getOutputConfig().quiet
153 const spinner = quiet ? null : ora(`Converting Deepnote project to ${formatNames[outputFormat]}...`).start()
154
155 try {
156 const ext = extname(absolutePath)
157 const filenameWithoutExtension = basename(absolutePath, ext)
158 const outputDir = options.output
159 ? resolve(process.cwd(), options.output)
160 : resolve(process.cwd(), filenameWithoutExtension)
161
162 await runFromDeepnoteConversion(outputFormat, absolutePath, { outputDir })
163
164 spinner?.succeed(`${formatNames[outputFormat]} saved to ${getChalk().bold(outputDir)}`)
165
166 return {
167 success: true,
168 inputPath: absolutePath,
169 outputPath: outputDir,
170 inputFormat: 'deepnote',
171 outputFormat,
172 outputIsDirectory: true,
173 }
174 } catch (error) {
175 spinner?.fail('Conversion failed')
176 throw error
177 }
178}
179
180const INPUT_FORMAT_NAMES: Record<SourceNotebookFormat, string> = {
181 jupyter: 'Jupyter Notebook',

Callers 1

convertFileFunction · 0.85

Calls 5

isSourceNotebookFormatFunction · 0.90
getOutputConfigFunction · 0.90
getChalkFunction · 0.90
startMethod · 0.80

Tested by

no test coverage detected