jellycell.format.parse

Parse and write jellycell notebooks (jupytext percent format + PEP-723).

The flow, per spec §2.2:

  1. parse strips the PEP-723 block, runs :mod:jupytext on the remainder, then wraps the result in our :class:~jellycell.format.cells.Notebook IR.

  2. write re-emits via :mod:jupytext and re-inserts the raw PEP-723 block verbatim at the top.

Byte-exact round-trip is verified for canonical percent-format inputs. See tests/unit/test_format_parse.py.

Module Contents

Functions

parse

Read and parse a jellycell notebook from disk.

parse_text

Parse a jellycell notebook from a string.

write

Write a jellycell notebook to disk.

write_text

Serialize a :class:Notebook to jellycell percent-format text.

API

jellycell.format.parse.parse(path: pathlib.Path) jellycell.format.cells.Notebook

Read and parse a jellycell notebook from disk.

jellycell.format.parse.parse_text(text: str) jellycell.format.cells.Notebook

Parse a jellycell notebook from a string.

jellycell.format.parse.write(notebook: jellycell.format.cells.Notebook, path: pathlib.Path) None

Write a jellycell notebook to disk.

jellycell.format.parse.write_text(notebook: jellycell.format.cells.Notebook) str

Serialize a :class:Notebook to jellycell percent-format text.