ydiff

raw JSON →
1.5 verified Fri May 01 auth: no python

A terminal-based tool for viewing colored, incremental diffs either from stdin or by comparing two files, supporting side-by-side and unified modes with auto-paging. Current version 1.5, requires Python >=3.3. Releases are infrequent.

pip install ydiff
error ModuleNotFoundError: No module named 'ydiff'
cause Attempting to import ydiff as a Python module instead of using it as a CLI tool.
fix
Use subprocess to run ydiff: subprocess.run(['ydiff', ...])
error ydiff: error: unrecognized arguments: -s
cause Using deprecated or incorrect command-line flag.
fix
Run 'ydiff --help' to see current valid options.
gotcha ydiff is primarily a CLI tool and not intended to be imported as a Python module. Importing 'ydiff' directly may not work or may have unexpected behavior.
fix Use subprocess to run ydiff as an external command.
deprecated The old command-line flags from earlier versions (e.g., 'ydiff -s' for side-by-side) may be deprecated. Always check the current help with 'ydiff --help'.
fix Use the modern flags: 'ydiff -m' or 'ydiff --side-by-side'.

ydiff is not designed as an importable Python module; it is meant to be run from the command line. Use subprocess to invoke it from Python.

import subprocess
import sys

# ydiff is a command-line tool, not typically imported as a library.
# To use it from Python, call it as a subprocess.
result = subprocess.run(['ydiff', '--version'], capture_output=True, text=True)
print(result.stdout.strip())