View differences between two files, urls or stringsΒΆ

Links: notebook, html, PDF, python, slides, GitHub

pyquickhelper implements a function to visual differences between two strings, pyensae implements it as a magic command.

import pyensae
%load_ext pyquickhelper
%textdiff -h
usage: textdiff [-h] [-c CONTEXT] [-i] [-e ENCODING] f1 f2
show the differences between two files, two text
positional arguments:
  f1                    first file or text or url
  f2                    second file or text or url
optional arguments:
  -h, --help            show this help message and exit
  -c CONTEXT, --context CONTEXT
                        context view, empty to see everything, > 0 to see only
                        a couple of lines around the changes
  -i, --inline          True=one column (inline) or False=two columns
  -e ENCODING, --encoding ENCODING
                        file encoding
usage: textdiff [-h] [-c CONTEXT] [-i] [-e ENCODING] f1 f2
import os
rep = os.path.join("..", "..", "src", "pyensae", "sql", "type_helpers.py")
f2 = "https://raw.githubusercontent.com/sdpython/pyensae/master/src/pyensae/sql/type_helpers.py"
%textdiff f2 rep -c 3 -i
populating...
<IPython.core.display.Javascript object>