diff --git a/jupytext/compare.py b/jupytext/compare.py index 8c77e23c9..1e0adb964 100644 --- a/jupytext/compare.py +++ b/jupytext/compare.py @@ -32,9 +32,12 @@ def filtered_cell(cell, preserve_outputs, cell_metadata_filter): def filtered_notebook_metadata(notebook): """Notebook metadata, filtered for metadata added by Jupytext itself""" metadata = copy(notebook.metadata) - return filter_metadata(metadata, - notebook.metadata.get('jupytext', {}).get('metadata_filter', {}).get('notebook'), - _DEFAULT_NOTEBOOK_METADATA.replace('jupytext,', '')) + metadata = filter_metadata(metadata, + notebook.metadata.get('jupytext', {}).get('metadata_filter', {}).get('notebook'), + _DEFAULT_NOTEBOOK_METADATA) + if 'jupytext' in metadata: + del metadata['jupytext'] + return metadata class NotebookDifference(Exception):