jellycell.format.cells¶
Pydantic IR for notebook cells.
We keep nbformat’s :class:~nbformat.NotebookNode for I/O (mime bundles,
outputs), but everything we reason about (cells, tags, deps, PEP-723 metadata)
lives in the pydantic models defined here. See spec §2.2.
Module Contents¶
Classes¶
Data¶
API¶
- jellycell.format.cells.CellKind¶
None
- class jellycell.format.cells.CellSpec(/, **data: Any)¶
Bases:
pydantic.BaseModelParsed form of a cell’s
jc.*tags (spec §2.2).Initialization
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config¶
‘ConfigDict(…)’
- kind: jellycell.format.cells.CellKind¶
‘step’
The
jc.<kind>category. Defaults tostepfor untagged code cells.
- class jellycell.format.cells.Cell(/, **data: Any)¶
Bases:
pydantic.BaseModelA single notebook cell — jellycell’s in-memory representation.
Initialization
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config¶
‘ConfigDict(…)’
- spec: jellycell.format.cells.CellSpec¶
‘Field(…)’
Parsed tags. Non-
codecells always have default spec.
- class jellycell.format.cells.Notebook(/, **data: Any)¶
Bases:
pydantic.BaseModelA parsed jellycell notebook.
Initialization
Create a new model by parsing and validating input data from keyword arguments.
Raises [
ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.selfis explicitly positional-only to allowselfas a field name.- model_config¶
‘ConfigDict(…)’
- cells: list[jellycell.format.cells.Cell]¶
None
All cells, preserving source order.
- metadata: dict[str, Any]¶
‘Field(…)’
Notebook-level metadata.
metadata['jellycell']['pep723']holds the verbatim PEP-723 block string when present (spec §2.2).