Skip to main content

notebook

Notebook and code file utilities for Datalayer Core.

def get_cells(filepath: pathlib.Path) -> Iterator[tuple[Optional[str], str]]

Extract cells from a Python file or Jupyter notebook.

Parameters

  • filepath : Path

    Path to the file to extract cells from.

Yields

  • Iterator[tuple[Optional[str], str]]

    Iterator yielding (cell_id, cell_source) tuples. For Python files, cell_id will be None. For Jupyter notebooks, cell_id will be the cell's ID.