Skip to content

Notebook.remove and del_cells: remove cells by id or held cell - #923

Open
ncoop57 wants to merge 1 commit into
mainfrom
notebook-remove
Open

Notebook.remove and del_cells: remove cells by id or held cell#923
ncoop57 wants to merge 1 commit into
mainfrom
notebook-remove

Conversation

@ncoop57

@ncoop57 ncoop57 commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Notebook.remove(*ids) removes cells by id, index, or held NbCell and returns them. del_cells(path, *ids) is its path-taking twin: it removes, saves, and returns CellRow snapshots. move now calls remove.

Why

del nb[k] removes one cell by id or index. It cannot remove several cells in one call, and it cannot pick between two cells that share an id. nbdev's merge driver leaves a notebook that way after a conflict: both versions of the cell keep the original id, between marker cells.

Changes

  • nbs/13_nbio.ipynb: remove after the del nbo[0] lesson, with a lesson cell that removes one cell by id prefix and one by held object. move delegates to it. del_cells after the find_cells twin, where CellRow is defined, with a lesson cell on a temporary notebook.
  • fastcore/editskill.py: del_cells in the import and __all__.
  • fastcore/nbio.py, fastcore/_modidx.py: regenerated.

@ncoop57 ncoop57 added the enhancement New feature or request label Aug 29, 2026
@ncoop57
ncoop57 requested a review from jph00 August 29, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant