Closed
Description
Issue
pytest-notebook
is incompatible with nbdime>=4.0.0
as nbdime.diffing.generic.diff
dropped the predicates
keyword argument.
Notes
nbdime
PR: Add support for using cell ID in diffing and merging jupyter/nbdime#639pytest-notebook
usage: https://github.com/chrisjsewell/pytest-notebook/blob/413609804db1568d0dc9024902778be8171d1a2a/pytest_notebook/diffing.py#L82C10-L82C10
Stack Trace
def diff_notebooks(
initial: NotebookNode, final: NotebookNode, initial_path: str = ""
) -> List[DiffEntry]:
"""Compare two notebooks.
This is a simplified version of ``nbdime.diff_notebooks()``, where we replace
``nbdime.diff_sequence_multilevel()`` with ``diff_sequence_simple()``
to diff the cell and output lists.
``diff_sequence_multilevel`` use 'snakes' computation, to guess where cells have
been inserted/removed. However, this can lead to longer diffs, where cells with
changed outputs are assigned as removed/inserted, rather than simply modified.
Moreover, since we are comparing the same notebook before/after execution,
we shouldn't need to worry about insertions.
"""
> return diff(
initial,
final,
path=initial_path,
predicates=defaultdict2(lambda: [operator.__eq__], {}),
differs=defaultdict2(
lambda: diff,
{
"/cells": diff_sequence_simple,
"/cells/*": diff,
"/cells/*/outputs": diff_sequence_simple,
"/cells/*/outputs/*": diff_single_outputs,
"/cells/*/attachments": diff_attachments,
},
),
)
E TypeError: diff() got an unexpected keyword argument 'predicates'
/usr/local/lib/python3.11/site-packages/pytest_notebook/diffing.py:78: TypeError
Metadata
Metadata
Assignees
Labels
No labels