@deepnote/convert 1.4.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -71
- package/dist/bin.js +154 -45
- package/dist/index.d.ts +476 -13
- package/dist/index.js +2 -2
- package/dist/src-CUESP0m8.js +1441 -0
- package/package.json +2 -2
- package/dist/src-DgOsAHcf.js +0 -309
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
|
|
3
3
|
//#region ../blocks/src/deserialize-file/deepnote-file-schema.d.ts
|
|
4
4
|
declare const deepnoteBlockSchema: z.ZodObject<{
|
|
5
|
-
blockGroup: z.
|
|
5
|
+
blockGroup: z.ZodString;
|
|
6
6
|
content: z.ZodOptional<z.ZodString>;
|
|
7
7
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
8
8
|
executionCount: z.ZodOptional<z.ZodNumber>;
|
|
@@ -15,10 +15,10 @@ declare const deepnoteBlockSchema: z.ZodObject<{
|
|
|
15
15
|
type: z.ZodString;
|
|
16
16
|
version: z.ZodOptional<z.ZodNumber>;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
blockGroup: string;
|
|
18
19
|
id: string;
|
|
19
20
|
type: string;
|
|
20
21
|
sortingKey: string;
|
|
21
|
-
blockGroup?: string | undefined;
|
|
22
22
|
content?: string | undefined;
|
|
23
23
|
contentHash?: string | undefined;
|
|
24
24
|
executionCount?: number | undefined;
|
|
@@ -28,10 +28,10 @@ declare const deepnoteBlockSchema: z.ZodObject<{
|
|
|
28
28
|
outputs?: any[] | undefined;
|
|
29
29
|
version?: number | undefined;
|
|
30
30
|
}, {
|
|
31
|
+
blockGroup: string;
|
|
31
32
|
id: string;
|
|
32
33
|
type: string;
|
|
33
34
|
sortingKey: string;
|
|
34
|
-
blockGroup?: string | undefined;
|
|
35
35
|
content?: string | undefined;
|
|
36
36
|
contentHash?: string | undefined;
|
|
37
37
|
executionCount?: number | undefined;
|
|
@@ -282,7 +282,7 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
282
282
|
name: z.ZodString;
|
|
283
283
|
notebooks: z.ZodArray<z.ZodObject<{
|
|
284
284
|
blocks: z.ZodArray<z.ZodObject<{
|
|
285
|
-
blockGroup: z.
|
|
285
|
+
blockGroup: z.ZodString;
|
|
286
286
|
content: z.ZodOptional<z.ZodString>;
|
|
287
287
|
contentHash: z.ZodOptional<z.ZodString>;
|
|
288
288
|
executionCount: z.ZodOptional<z.ZodNumber>;
|
|
@@ -295,10 +295,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
295
295
|
type: z.ZodString;
|
|
296
296
|
version: z.ZodOptional<z.ZodNumber>;
|
|
297
297
|
}, "strip", z.ZodTypeAny, {
|
|
298
|
+
blockGroup: string;
|
|
298
299
|
id: string;
|
|
299
300
|
type: string;
|
|
300
301
|
sortingKey: string;
|
|
301
|
-
blockGroup?: string | undefined;
|
|
302
302
|
content?: string | undefined;
|
|
303
303
|
contentHash?: string | undefined;
|
|
304
304
|
executionCount?: number | undefined;
|
|
@@ -308,10 +308,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
308
308
|
outputs?: any[] | undefined;
|
|
309
309
|
version?: number | undefined;
|
|
310
310
|
}, {
|
|
311
|
+
blockGroup: string;
|
|
311
312
|
id: string;
|
|
312
313
|
type: string;
|
|
313
314
|
sortingKey: string;
|
|
314
|
-
blockGroup?: string | undefined;
|
|
315
315
|
content?: string | undefined;
|
|
316
316
|
contentHash?: string | undefined;
|
|
317
317
|
executionCount?: number | undefined;
|
|
@@ -330,10 +330,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
330
330
|
id: string;
|
|
331
331
|
name: string;
|
|
332
332
|
blocks: {
|
|
333
|
+
blockGroup: string;
|
|
333
334
|
id: string;
|
|
334
335
|
type: string;
|
|
335
336
|
sortingKey: string;
|
|
336
|
-
blockGroup?: string | undefined;
|
|
337
337
|
content?: string | undefined;
|
|
338
338
|
contentHash?: string | undefined;
|
|
339
339
|
executionCount?: number | undefined;
|
|
@@ -350,10 +350,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
350
350
|
id: string;
|
|
351
351
|
name: string;
|
|
352
352
|
blocks: {
|
|
353
|
+
blockGroup: string;
|
|
353
354
|
id: string;
|
|
354
355
|
type: string;
|
|
355
356
|
sortingKey: string;
|
|
356
|
-
blockGroup?: string | undefined;
|
|
357
357
|
content?: string | undefined;
|
|
358
358
|
contentHash?: string | undefined;
|
|
359
359
|
executionCount?: number | undefined;
|
|
@@ -406,10 +406,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
406
406
|
id: string;
|
|
407
407
|
name: string;
|
|
408
408
|
blocks: {
|
|
409
|
+
blockGroup: string;
|
|
409
410
|
id: string;
|
|
410
411
|
type: string;
|
|
411
412
|
sortingKey: string;
|
|
412
|
-
blockGroup?: string | undefined;
|
|
413
413
|
content?: string | undefined;
|
|
414
414
|
contentHash?: string | undefined;
|
|
415
415
|
executionCount?: number | undefined;
|
|
@@ -444,10 +444,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
444
444
|
id: string;
|
|
445
445
|
name: string;
|
|
446
446
|
blocks: {
|
|
447
|
+
blockGroup: string;
|
|
447
448
|
id: string;
|
|
448
449
|
type: string;
|
|
449
450
|
sortingKey: string;
|
|
450
|
-
blockGroup?: string | undefined;
|
|
451
451
|
content?: string | undefined;
|
|
452
452
|
contentHash?: string | undefined;
|
|
453
453
|
executionCount?: number | undefined;
|
|
@@ -492,10 +492,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
492
492
|
id: string;
|
|
493
493
|
name: string;
|
|
494
494
|
blocks: {
|
|
495
|
+
blockGroup: string;
|
|
495
496
|
id: string;
|
|
496
497
|
type: string;
|
|
497
498
|
sortingKey: string;
|
|
498
|
-
blockGroup?: string | undefined;
|
|
499
499
|
content?: string | undefined;
|
|
500
500
|
contentHash?: string | undefined;
|
|
501
501
|
executionCount?: number | undefined;
|
|
@@ -566,10 +566,10 @@ declare const deepnoteFileSchema: z.ZodObject<{
|
|
|
566
566
|
id: string;
|
|
567
567
|
name: string;
|
|
568
568
|
blocks: {
|
|
569
|
+
blockGroup: string;
|
|
569
570
|
id: string;
|
|
570
571
|
type: string;
|
|
571
572
|
sortingKey: string;
|
|
572
|
-
blockGroup?: string | undefined;
|
|
573
573
|
content?: string | undefined;
|
|
574
574
|
contentHash?: string | undefined;
|
|
575
575
|
executionCount?: number | undefined;
|
|
@@ -738,6 +738,290 @@ declare function convertDeepnoteToJupyterNotebooks(deepnoteFile: DeepnoteFile):
|
|
|
738
738
|
*/
|
|
739
739
|
declare function convertDeepnoteFileToJupyterFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToJupyterOptions): Promise<void>;
|
|
740
740
|
//#endregion
|
|
741
|
+
//#region src/types/marimo.d.ts
|
|
742
|
+
/**
|
|
743
|
+
* Marimo (.py) format type definitions.
|
|
744
|
+
*
|
|
745
|
+
* Marimo is a reactive Python notebook that stores notebooks as pure Python files.
|
|
746
|
+
* Key characteristics:
|
|
747
|
+
* - Pure Python with @app.cell decorators
|
|
748
|
+
* - Reactive execution based on variable dependencies
|
|
749
|
+
* - Function signatures declare dependencies (def __(df): means "depends on df")
|
|
750
|
+
* - Return statements declare exports (return df, means "exports df")
|
|
751
|
+
*
|
|
752
|
+
* Example:
|
|
753
|
+
* ```python
|
|
754
|
+
* import marimo
|
|
755
|
+
*
|
|
756
|
+
* __generated_with = "0.8.0"
|
|
757
|
+
* app = marimo.App(width="medium")
|
|
758
|
+
*
|
|
759
|
+
* @app.cell
|
|
760
|
+
* def __():
|
|
761
|
+
* import pandas as pd
|
|
762
|
+
* return pd,
|
|
763
|
+
*
|
|
764
|
+
* @app.cell
|
|
765
|
+
* def __(pd):
|
|
766
|
+
* df = pd.read_csv("data.csv")
|
|
767
|
+
* return df,
|
|
768
|
+
*
|
|
769
|
+
* if __name__ == "__main__":
|
|
770
|
+
* app.run()
|
|
771
|
+
* ```
|
|
772
|
+
*/
|
|
773
|
+
interface MarimoCell {
|
|
774
|
+
/** Cell type: 'code', 'markdown', or 'sql' */
|
|
775
|
+
cellType: 'code' | 'markdown' | 'sql';
|
|
776
|
+
/** Cell content (Python code, markdown text, or SQL query) */
|
|
777
|
+
content: string;
|
|
778
|
+
/** Function name (usually __ for anonymous cells) */
|
|
779
|
+
functionName?: string;
|
|
780
|
+
/** Variables this cell depends on (from function parameters) */
|
|
781
|
+
dependencies?: string[];
|
|
782
|
+
/** Variables this cell exports (from return statement) */
|
|
783
|
+
exports?: string[];
|
|
784
|
+
/** Whether this cell is hidden in the UI */
|
|
785
|
+
hidden?: boolean;
|
|
786
|
+
/** Whether this cell is disabled */
|
|
787
|
+
disabled?: boolean;
|
|
788
|
+
}
|
|
789
|
+
interface MarimoApp {
|
|
790
|
+
/** Marimo version that generated this file */
|
|
791
|
+
generatedWith?: string;
|
|
792
|
+
/** App width setting ('medium', 'full', etc.) */
|
|
793
|
+
width?: string;
|
|
794
|
+
/** Array of cells */
|
|
795
|
+
cells: MarimoCell[];
|
|
796
|
+
/** App title (from app.title if present) */
|
|
797
|
+
title?: string;
|
|
798
|
+
}
|
|
799
|
+
//#endregion
|
|
800
|
+
//#region src/deepnote-to-marimo.d.ts
|
|
801
|
+
interface ConvertDeepnoteFileToMarimoOptions {
|
|
802
|
+
outputDir: string;
|
|
803
|
+
}
|
|
804
|
+
/**
|
|
805
|
+
* Converts an array of Deepnote blocks into a Marimo app.
|
|
806
|
+
* This is the lowest-level conversion function.
|
|
807
|
+
*
|
|
808
|
+
* @param blocks - Array of DeepnoteBlock objects to convert
|
|
809
|
+
* @param notebookName - Name of the notebook (used for app title)
|
|
810
|
+
* @returns A MarimoApp object
|
|
811
|
+
*/
|
|
812
|
+
declare function convertBlocksToMarimoApp(blocks: DeepnoteBlock[], notebookName: string): MarimoApp;
|
|
813
|
+
/**
|
|
814
|
+
* Converts a Deepnote project into Marimo app objects.
|
|
815
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
816
|
+
* Each notebook in the Deepnote project is converted to a separate Marimo app.
|
|
817
|
+
*
|
|
818
|
+
* @param deepnoteFile - The deserialized Deepnote project file
|
|
819
|
+
* @returns Array of objects containing filename and corresponding Marimo app
|
|
820
|
+
*/
|
|
821
|
+
declare function convertDeepnoteToMarimoApps(deepnoteFile: DeepnoteFile): Array<{
|
|
822
|
+
filename: string;
|
|
823
|
+
app: MarimoApp;
|
|
824
|
+
}>;
|
|
825
|
+
/**
|
|
826
|
+
* Serializes a Marimo app to a Python file string.
|
|
827
|
+
*
|
|
828
|
+
* @param app - The Marimo app to serialize
|
|
829
|
+
* @returns The serialized Python code string
|
|
830
|
+
*/
|
|
831
|
+
declare function serializeMarimoFormat(app: MarimoApp): string;
|
|
832
|
+
/**
|
|
833
|
+
* Converts a Deepnote project file into separate Marimo (.py) files.
|
|
834
|
+
* Each notebook in the Deepnote project becomes a separate .py file.
|
|
835
|
+
*/
|
|
836
|
+
declare function convertDeepnoteFileToMarimoFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToMarimoOptions): Promise<void>;
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/types/percent.d.ts
|
|
839
|
+
/**
|
|
840
|
+
* Percent format (.py with # %%) type definitions.
|
|
841
|
+
*
|
|
842
|
+
* The percent format is a convention for representing notebooks as plain Python files.
|
|
843
|
+
* It's supported by VS Code, Spyder, PyCharm, JupyText, and Hydrogen.
|
|
844
|
+
*
|
|
845
|
+
* Cell markers:
|
|
846
|
+
* - `# %%` - Code cell
|
|
847
|
+
* - `# %% [markdown]` - Markdown cell
|
|
848
|
+
* - `# %% [raw]` - Raw cell
|
|
849
|
+
* - `# %% title` - Code cell with title
|
|
850
|
+
* - `# %% [markdown] title` - Markdown cell with title
|
|
851
|
+
* - `# %% tags=["a", "b"]` - Cell with tags
|
|
852
|
+
*/
|
|
853
|
+
interface PercentCell {
|
|
854
|
+
/** Cell type: 'code', 'markdown', or 'raw' */
|
|
855
|
+
cellType: 'code' | 'markdown' | 'raw';
|
|
856
|
+
/** Cell content (for markdown cells, this is without the '# ' prefix on each line) */
|
|
857
|
+
content: string;
|
|
858
|
+
/** Optional cell title */
|
|
859
|
+
title?: string;
|
|
860
|
+
/** Optional cell tags */
|
|
861
|
+
tags?: string[];
|
|
862
|
+
/** Additional metadata from the cell marker */
|
|
863
|
+
metadata?: Record<string, unknown>;
|
|
864
|
+
}
|
|
865
|
+
interface PercentNotebook {
|
|
866
|
+
/** Array of cells in the notebook */
|
|
867
|
+
cells: PercentCell[];
|
|
868
|
+
/** Optional file-level metadata (from first line comments) */
|
|
869
|
+
metadata?: {
|
|
870
|
+
/** Original filename */
|
|
871
|
+
filename?: string;
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
//#endregion
|
|
875
|
+
//#region src/deepnote-to-percent.d.ts
|
|
876
|
+
interface ConvertDeepnoteFileToPercentOptions {
|
|
877
|
+
outputDir: string;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Converts an array of Deepnote blocks into a percent format notebook.
|
|
881
|
+
* This is the lowest-level conversion function.
|
|
882
|
+
*
|
|
883
|
+
* @param blocks - Array of DeepnoteBlock objects to convert
|
|
884
|
+
* @returns A PercentNotebook object
|
|
885
|
+
*/
|
|
886
|
+
declare function convertBlocksToPercentNotebook(blocks: DeepnoteBlock[]): PercentNotebook;
|
|
887
|
+
/**
|
|
888
|
+
* Converts a Deepnote project into percent format notebook objects.
|
|
889
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
890
|
+
* Each notebook in the Deepnote project is converted to a separate percent notebook.
|
|
891
|
+
*
|
|
892
|
+
* @param deepnoteFile - The deserialized Deepnote project file
|
|
893
|
+
* @returns Array of objects containing filename and corresponding percent notebook
|
|
894
|
+
*/
|
|
895
|
+
declare function convertDeepnoteToPercentNotebooks(deepnoteFile: DeepnoteFile): Array<{
|
|
896
|
+
filename: string;
|
|
897
|
+
notebook: PercentNotebook;
|
|
898
|
+
}>;
|
|
899
|
+
/**
|
|
900
|
+
* Serializes a percent format notebook to a string.
|
|
901
|
+
*
|
|
902
|
+
* @param notebook - The percent notebook to serialize
|
|
903
|
+
* @returns The serialized percent format string
|
|
904
|
+
*/
|
|
905
|
+
declare function serializePercentFormat(notebook: PercentNotebook): string;
|
|
906
|
+
/**
|
|
907
|
+
* Converts a Deepnote project file into separate percent format (.py) files.
|
|
908
|
+
* Each notebook in the Deepnote project becomes a separate .py file.
|
|
909
|
+
*/
|
|
910
|
+
declare function convertDeepnoteFileToPercentFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToPercentOptions): Promise<void>;
|
|
911
|
+
//#endregion
|
|
912
|
+
//#region src/types/quarto.d.ts
|
|
913
|
+
/**
|
|
914
|
+
* Quarto (.qmd) format type definitions.
|
|
915
|
+
*
|
|
916
|
+
* Quarto is a next-generation publishing system for scientific and technical documents.
|
|
917
|
+
* It uses markdown with code chunks similar to R Markdown but is language-agnostic.
|
|
918
|
+
*
|
|
919
|
+
* Key elements:
|
|
920
|
+
* - YAML frontmatter for document metadata
|
|
921
|
+
* - Code chunks with ```{python} or ```{r} fencing
|
|
922
|
+
* - Cell options using #| syntax (e.g., #| label: my-chunk)
|
|
923
|
+
* - Rich markdown with special directives
|
|
924
|
+
*/
|
|
925
|
+
interface QuartoCell {
|
|
926
|
+
/** Cell type: 'code' or 'markdown' */
|
|
927
|
+
cellType: 'code' | 'markdown';
|
|
928
|
+
/** Cell content (code or markdown text) */
|
|
929
|
+
content: string;
|
|
930
|
+
/** Language for code cells (e.g., 'python', 'r') */
|
|
931
|
+
language?: string;
|
|
932
|
+
/** Cell options from #| lines */
|
|
933
|
+
options?: QuartoCellOptions;
|
|
934
|
+
}
|
|
935
|
+
interface QuartoCellOptions {
|
|
936
|
+
/** Cell label/identifier */
|
|
937
|
+
label?: string;
|
|
938
|
+
/** Whether to show the code in output */
|
|
939
|
+
echo?: boolean;
|
|
940
|
+
/** Whether to evaluate the code */
|
|
941
|
+
eval?: boolean;
|
|
942
|
+
/** Whether to show output */
|
|
943
|
+
output?: boolean;
|
|
944
|
+
/** Figure caption */
|
|
945
|
+
figCap?: string;
|
|
946
|
+
/** Figure width */
|
|
947
|
+
figWidth?: number;
|
|
948
|
+
/** Figure height */
|
|
949
|
+
figHeight?: number;
|
|
950
|
+
/** Table caption */
|
|
951
|
+
tblCap?: string;
|
|
952
|
+
/** Warning display setting */
|
|
953
|
+
warning?: boolean;
|
|
954
|
+
/** Message display setting */
|
|
955
|
+
message?: boolean;
|
|
956
|
+
/** Additional raw options */
|
|
957
|
+
raw?: Record<string, unknown>;
|
|
958
|
+
}
|
|
959
|
+
interface QuartoFrontmatter {
|
|
960
|
+
/** Document title */
|
|
961
|
+
title?: string;
|
|
962
|
+
/** Author(s) */
|
|
963
|
+
author?: string | string[];
|
|
964
|
+
/** Document date */
|
|
965
|
+
date?: string;
|
|
966
|
+
/** Output format(s) */
|
|
967
|
+
format?: string | Record<string, unknown>;
|
|
968
|
+
/** Jupyter kernel specification */
|
|
969
|
+
jupyter?: string;
|
|
970
|
+
/** Execute options */
|
|
971
|
+
execute?: {
|
|
972
|
+
echo?: boolean;
|
|
973
|
+
eval?: boolean;
|
|
974
|
+
warning?: boolean;
|
|
975
|
+
output?: boolean;
|
|
976
|
+
};
|
|
977
|
+
/** Additional metadata */
|
|
978
|
+
[key: string]: unknown;
|
|
979
|
+
}
|
|
980
|
+
interface QuartoDocument {
|
|
981
|
+
/** YAML frontmatter metadata */
|
|
982
|
+
frontmatter?: QuartoFrontmatter;
|
|
983
|
+
/** Array of cells (code chunks and markdown) */
|
|
984
|
+
cells: QuartoCell[];
|
|
985
|
+
}
|
|
986
|
+
//#endregion
|
|
987
|
+
//#region src/deepnote-to-quarto.d.ts
|
|
988
|
+
interface ConvertDeepnoteFileToQuartoOptions {
|
|
989
|
+
outputDir: string;
|
|
990
|
+
}
|
|
991
|
+
/**
|
|
992
|
+
* Converts an array of Deepnote blocks into a Quarto document.
|
|
993
|
+
* This is the lowest-level conversion function.
|
|
994
|
+
*
|
|
995
|
+
* @param blocks - Array of DeepnoteBlock objects to convert
|
|
996
|
+
* @param notebookName - Name of the notebook (used for document title)
|
|
997
|
+
* @returns A QuartoDocument object
|
|
998
|
+
*/
|
|
999
|
+
declare function convertBlocksToQuartoDocument(blocks: DeepnoteBlock[], notebookName: string): QuartoDocument;
|
|
1000
|
+
/**
|
|
1001
|
+
* Converts a Deepnote project into Quarto document objects.
|
|
1002
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
1003
|
+
* Each notebook in the Deepnote project is converted to a separate Quarto document.
|
|
1004
|
+
*
|
|
1005
|
+
* @param deepnoteFile - The deserialized Deepnote project file
|
|
1006
|
+
* @returns Array of objects containing filename and corresponding Quarto document
|
|
1007
|
+
*/
|
|
1008
|
+
declare function convertDeepnoteToQuartoDocuments(deepnoteFile: DeepnoteFile): Array<{
|
|
1009
|
+
filename: string;
|
|
1010
|
+
document: QuartoDocument;
|
|
1011
|
+
}>;
|
|
1012
|
+
/**
|
|
1013
|
+
* Serializes a Quarto document to a string.
|
|
1014
|
+
*
|
|
1015
|
+
* @param document - The Quarto document to serialize
|
|
1016
|
+
* @returns The serialized Quarto format string
|
|
1017
|
+
*/
|
|
1018
|
+
declare function serializeQuartoFormat(document: QuartoDocument): string;
|
|
1019
|
+
/**
|
|
1020
|
+
* Converts a Deepnote project file into separate Quarto (.qmd) files.
|
|
1021
|
+
* Each notebook in the Deepnote project becomes a separate .qmd file.
|
|
1022
|
+
*/
|
|
1023
|
+
declare function convertDeepnoteFileToQuartoFiles(deepnoteFilePath: string, options: ConvertDeepnoteFileToQuartoOptions): Promise<void>;
|
|
1024
|
+
//#endregion
|
|
741
1025
|
//#region src/jupyter-to-deepnote.d.ts
|
|
742
1026
|
interface ConvertIpynbFilesToDeepnoteFileOptions {
|
|
743
1027
|
outputPath: string;
|
|
@@ -786,4 +1070,183 @@ declare function convertJupyterNotebooksToDeepnote(notebooks: JupyterNotebookInp
|
|
|
786
1070
|
*/
|
|
787
1071
|
declare function convertIpynbFilesToDeepnoteFile(inputFilePaths: string[], options: ConvertIpynbFilesToDeepnoteFileOptions): Promise<void>;
|
|
788
1072
|
//#endregion
|
|
789
|
-
|
|
1073
|
+
//#region src/marimo-to-deepnote.d.ts
|
|
1074
|
+
interface ConvertMarimoFilesToDeepnoteFileOptions {
|
|
1075
|
+
outputPath: string;
|
|
1076
|
+
projectName: string;
|
|
1077
|
+
}
|
|
1078
|
+
interface ConvertMarimoAppOptions {
|
|
1079
|
+
/** Custom ID generator function. Defaults to uuid v4. */
|
|
1080
|
+
idGenerator?: () => string;
|
|
1081
|
+
}
|
|
1082
|
+
interface MarimoAppInput {
|
|
1083
|
+
filename: string;
|
|
1084
|
+
app: MarimoApp;
|
|
1085
|
+
}
|
|
1086
|
+
/**
|
|
1087
|
+
* Parses a Marimo Python file into a MarimoApp structure.
|
|
1088
|
+
*
|
|
1089
|
+
* @param content - The raw content of the .py file
|
|
1090
|
+
* @returns A MarimoApp object
|
|
1091
|
+
*
|
|
1092
|
+
* @example
|
|
1093
|
+
* ```typescript
|
|
1094
|
+
* const content = `import marimo
|
|
1095
|
+
*
|
|
1096
|
+
* app = marimo.App()
|
|
1097
|
+
*
|
|
1098
|
+
* @app.cell
|
|
1099
|
+
* def __():
|
|
1100
|
+
* print("hello")
|
|
1101
|
+
* return
|
|
1102
|
+
* `
|
|
1103
|
+
* const app = parseMarimoFormat(content)
|
|
1104
|
+
* ```
|
|
1105
|
+
*/
|
|
1106
|
+
declare function parseMarimoFormat(content: string): MarimoApp;
|
|
1107
|
+
/**
|
|
1108
|
+
* Converts a single Marimo app into an array of Deepnote blocks.
|
|
1109
|
+
* This is the lowest-level conversion function.
|
|
1110
|
+
*
|
|
1111
|
+
* @param app - The Marimo app object to convert
|
|
1112
|
+
* @param options - Optional conversion options including custom ID generator
|
|
1113
|
+
* @returns Array of DeepnoteBlock objects
|
|
1114
|
+
*/
|
|
1115
|
+
declare function convertMarimoAppToBlocks(app: MarimoApp, options?: ConvertMarimoAppOptions): DeepnoteBlock[];
|
|
1116
|
+
interface ConvertMarimoAppsToDeepnoteOptions {
|
|
1117
|
+
/** Project name for the Deepnote file */
|
|
1118
|
+
projectName: string;
|
|
1119
|
+
/** Custom ID generator function. Defaults to uuid v4. */
|
|
1120
|
+
idGenerator?: () => string;
|
|
1121
|
+
}
|
|
1122
|
+
/**
|
|
1123
|
+
* Converts Marimo app objects into a Deepnote project file.
|
|
1124
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
1125
|
+
*
|
|
1126
|
+
* @param apps - Array of Marimo apps with filenames
|
|
1127
|
+
* @param options - Conversion options including project name and optional ID generator
|
|
1128
|
+
* @returns A DeepnoteFile object
|
|
1129
|
+
*/
|
|
1130
|
+
declare function convertMarimoAppsToDeepnote(apps: MarimoAppInput[], options: ConvertMarimoAppsToDeepnoteOptions): DeepnoteFile;
|
|
1131
|
+
/**
|
|
1132
|
+
* Converts multiple Marimo (.py) files into a single Deepnote project file.
|
|
1133
|
+
*/
|
|
1134
|
+
declare function convertMarimoFilesToDeepnoteFile(inputFilePaths: string[], options: ConvertMarimoFilesToDeepnoteFileOptions): Promise<void>;
|
|
1135
|
+
//#endregion
|
|
1136
|
+
//#region src/percent-to-deepnote.d.ts
|
|
1137
|
+
interface ConvertPercentFilesToDeepnoteFileOptions {
|
|
1138
|
+
outputPath: string;
|
|
1139
|
+
projectName: string;
|
|
1140
|
+
}
|
|
1141
|
+
interface ConvertPercentNotebookOptions {
|
|
1142
|
+
/** Custom ID generator function. Defaults to uuid v4. */
|
|
1143
|
+
idGenerator?: () => string;
|
|
1144
|
+
}
|
|
1145
|
+
interface PercentNotebookInput {
|
|
1146
|
+
filename: string;
|
|
1147
|
+
notebook: PercentNotebook;
|
|
1148
|
+
}
|
|
1149
|
+
/**
|
|
1150
|
+
* Parses a percent format Python file into a PercentNotebook structure.
|
|
1151
|
+
*
|
|
1152
|
+
* @param content - The raw content of the .py file
|
|
1153
|
+
* @returns A PercentNotebook object
|
|
1154
|
+
*
|
|
1155
|
+
* @example
|
|
1156
|
+
* ```typescript
|
|
1157
|
+
* const content = `# %% [markdown]
|
|
1158
|
+
* # # My Title
|
|
1159
|
+
*
|
|
1160
|
+
* # %%
|
|
1161
|
+
* print("hello")
|
|
1162
|
+
* `
|
|
1163
|
+
* const notebook = parsePercentFormat(content)
|
|
1164
|
+
* ```
|
|
1165
|
+
*/
|
|
1166
|
+
declare function parsePercentFormat(content: string): PercentNotebook;
|
|
1167
|
+
/**
|
|
1168
|
+
* Converts a single percent format notebook into an array of Deepnote blocks.
|
|
1169
|
+
* This is the lowest-level conversion function.
|
|
1170
|
+
*
|
|
1171
|
+
* @param notebook - The percent notebook object to convert
|
|
1172
|
+
* @param options - Optional conversion options including custom ID generator
|
|
1173
|
+
* @returns Array of DeepnoteBlock objects
|
|
1174
|
+
*/
|
|
1175
|
+
declare function convertPercentNotebookToBlocks(notebook: PercentNotebook, options?: ConvertPercentNotebookOptions): DeepnoteBlock[];
|
|
1176
|
+
/**
|
|
1177
|
+
* Converts percent format notebook objects into a Deepnote project file.
|
|
1178
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
1179
|
+
*
|
|
1180
|
+
* @param notebooks - Array of percent notebooks with filenames
|
|
1181
|
+
* @param options - Conversion options including project name
|
|
1182
|
+
* @returns A DeepnoteFile object
|
|
1183
|
+
*/
|
|
1184
|
+
declare function convertPercentNotebooksToDeepnote(notebooks: PercentNotebookInput[], options: {
|
|
1185
|
+
projectName: string;
|
|
1186
|
+
}): DeepnoteFile;
|
|
1187
|
+
/**
|
|
1188
|
+
* Converts multiple percent format (.py) files into a single Deepnote project file.
|
|
1189
|
+
*/
|
|
1190
|
+
declare function convertPercentFilesToDeepnoteFile(inputFilePaths: string[], options: ConvertPercentFilesToDeepnoteFileOptions): Promise<void>;
|
|
1191
|
+
//#endregion
|
|
1192
|
+
//#region src/quarto-to-deepnote.d.ts
|
|
1193
|
+
interface ConvertQuartoFilesToDeepnoteFileOptions {
|
|
1194
|
+
outputPath: string;
|
|
1195
|
+
projectName: string;
|
|
1196
|
+
}
|
|
1197
|
+
interface ConvertQuartoDocumentOptions {
|
|
1198
|
+
/** Custom ID generator function. Defaults to uuid v4. */
|
|
1199
|
+
idGenerator?: () => string;
|
|
1200
|
+
}
|
|
1201
|
+
interface QuartoDocumentInput {
|
|
1202
|
+
filename: string;
|
|
1203
|
+
document: QuartoDocument;
|
|
1204
|
+
}
|
|
1205
|
+
/**
|
|
1206
|
+
* Parses a Quarto (.qmd) file into a QuartoDocument structure.
|
|
1207
|
+
*
|
|
1208
|
+
* @param content - The raw content of the .qmd file
|
|
1209
|
+
* @returns A QuartoDocument object
|
|
1210
|
+
*
|
|
1211
|
+
* @example
|
|
1212
|
+
* ```typescript
|
|
1213
|
+
* const content = `---
|
|
1214
|
+
* title: "My Document"
|
|
1215
|
+
* ---
|
|
1216
|
+
*
|
|
1217
|
+
* # Introduction
|
|
1218
|
+
*
|
|
1219
|
+
* \`\`\`{python}
|
|
1220
|
+
* print("hello")
|
|
1221
|
+
* \`\`\`
|
|
1222
|
+
* `
|
|
1223
|
+
* const doc = parseQuartoFormat(content)
|
|
1224
|
+
* ```
|
|
1225
|
+
*/
|
|
1226
|
+
declare function parseQuartoFormat(content: string): QuartoDocument;
|
|
1227
|
+
/**
|
|
1228
|
+
* Converts a single Quarto document into an array of Deepnote blocks.
|
|
1229
|
+
* This is the lowest-level conversion function.
|
|
1230
|
+
*
|
|
1231
|
+
* @param document - The Quarto document object to convert
|
|
1232
|
+
* @param options - Optional conversion options including custom ID generator
|
|
1233
|
+
* @returns Array of DeepnoteBlock objects
|
|
1234
|
+
*/
|
|
1235
|
+
declare function convertQuartoDocumentToBlocks(document: QuartoDocument, options?: ConvertQuartoDocumentOptions): DeepnoteBlock[];
|
|
1236
|
+
/**
|
|
1237
|
+
* Converts Quarto document objects into a Deepnote project file.
|
|
1238
|
+
* This is a pure conversion function that doesn't perform any file I/O.
|
|
1239
|
+
*
|
|
1240
|
+
* @param documents - Array of Quarto documents with filenames
|
|
1241
|
+
* @param options - Conversion options including project name
|
|
1242
|
+
* @returns A DeepnoteFile object
|
|
1243
|
+
*/
|
|
1244
|
+
declare function convertQuartoDocumentsToDeepnote(documents: QuartoDocumentInput[], options: {
|
|
1245
|
+
projectName: string;
|
|
1246
|
+
}): DeepnoteFile;
|
|
1247
|
+
/**
|
|
1248
|
+
* Converts multiple Quarto (.qmd) files into a single Deepnote project file.
|
|
1249
|
+
*/
|
|
1250
|
+
declare function convertQuartoFilesToDeepnoteFile(inputFilePaths: string[], options: ConvertQuartoFilesToDeepnoteFileOptions): Promise<void>;
|
|
1251
|
+
//#endregion
|
|
1252
|
+
export { type ConvertBlocksToJupyterOptions, type ConvertDeepnoteFileToMarimoOptions, type ConvertDeepnoteFileToPercentOptions, type ConvertDeepnoteFileToQuartoOptions, type ConvertIpynbFilesToDeepnoteFileOptions, type ConvertJupyterNotebookOptions, type ConvertMarimoAppOptions, type ConvertMarimoAppsToDeepnoteOptions, type ConvertMarimoFilesToDeepnoteFileOptions, type ConvertPercentFilesToDeepnoteFileOptions, type ConvertPercentNotebookOptions, type ConvertQuartoDocumentOptions, type ConvertQuartoFilesToDeepnoteFileOptions, type JupyterCell, type JupyterNotebook, type JupyterNotebookInput, type MarimoApp, type MarimoAppInput, type MarimoCell, type PercentCell, type PercentNotebook, type PercentNotebookInput, type QuartoCell, type QuartoCellOptions, type QuartoDocument, type QuartoDocumentInput, type QuartoFrontmatter, convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles as convertDeepnoteFileToJupyter, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { A as convertDeepnoteToJupyterNotebooks, C as serializePercentFormat, D as serializeMarimoFormat, E as convertDeepnoteToMarimoApps, O as convertBlocksToJupyterNotebook, S as convertDeepnoteToPercentNotebooks, T as convertDeepnoteFileToMarimoFiles, _ as convertDeepnoteFileToQuartoFiles, a as convertPercentFilesToDeepnoteFile, b as convertBlocksToPercentNotebook, c as parsePercentFormat, d as convertMarimoFilesToDeepnoteFile, f as parseMarimoFormat, g as convertBlocksToQuartoDocument, h as convertJupyterNotebooksToDeepnote, i as parseQuartoFormat, k as convertDeepnoteFileToJupyterFiles, l as convertMarimoAppToBlocks, m as convertJupyterNotebookToBlocks, n as convertQuartoDocumentsToDeepnote, o as convertPercentNotebookToBlocks, p as convertIpynbFilesToDeepnoteFile, r as convertQuartoFilesToDeepnoteFile, s as convertPercentNotebooksToDeepnote, t as convertQuartoDocumentToBlocks, u as convertMarimoAppsToDeepnote, v as convertDeepnoteToQuartoDocuments, w as convertBlocksToMarimoApp, x as convertDeepnoteFileToPercentFiles, y as serializeQuartoFormat } from "./src-CUESP0m8.js";
|
|
2
2
|
|
|
3
|
-
export { convertBlocksToJupyterNotebook, convertDeepnoteFileToJupyterFiles as convertDeepnoteFileToJupyter, convertDeepnoteToJupyterNotebooks, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote };
|
|
3
|
+
export { convertBlocksToJupyterNotebook, convertBlocksToMarimoApp, convertBlocksToPercentNotebook, convertBlocksToQuartoDocument, convertDeepnoteFileToJupyterFiles as convertDeepnoteFileToJupyter, convertDeepnoteFileToMarimoFiles, convertDeepnoteFileToPercentFiles, convertDeepnoteFileToQuartoFiles, convertDeepnoteToJupyterNotebooks, convertDeepnoteToMarimoApps, convertDeepnoteToPercentNotebooks, convertDeepnoteToQuartoDocuments, convertIpynbFilesToDeepnoteFile, convertJupyterNotebookToBlocks, convertJupyterNotebooksToDeepnote, convertMarimoAppToBlocks, convertMarimoAppsToDeepnote, convertMarimoFilesToDeepnoteFile, convertPercentFilesToDeepnoteFile, convertPercentNotebookToBlocks, convertPercentNotebooksToDeepnote, convertQuartoDocumentToBlocks, convertQuartoDocumentsToDeepnote, convertQuartoFilesToDeepnoteFile, parseMarimoFormat, parsePercentFormat, parseQuartoFormat, serializeMarimoFormat, serializePercentFormat, serializeQuartoFormat };
|