Skip to content

Incompatible with nbdime version 4.0.0+ #59

Closed
@renonat

Description

@renonat

Issue

pytest-notebook is incompatible with nbdime>=4.0.0 as nbdime.diffing.generic.diff dropped the predicates keyword argument.

Notes

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions