icdiff is a Python library and command-line utility for displaying diffs with improved colorization, making it easier to read changes side-by-side. It aims to be a more user-friendly alternative to traditional `diff` output. The current version is 2.0.10, and it maintains a fairly active release cadence with updates typically every few months.
pip install icdiffVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `ConsoleDiff` to generate a colored, side-by-side diff between two lists of strings. It configures the diff for a specific column width, includes line numbers, and sets custom file labels for the header.
Consider `difflib` for non-visual, programmatic diffing or when fine-grained control over diff algorithm is required without console-specific formatting.
Always pass the actual content of the files as lists of strings (e.g., `file1.readlines()`) to `make_table()`. The `fromfile` and `tofile` arguments are just metadata for the output header.
When using `ConsoleDiff` programmatically and outputting to a non-TTY (like a file), instantiate it with `color=False` (e.g., `ConsoleDiff(color=False)`) to prevent ANSI escape codes from being included in the output.
Use `icdiff` as a command-line tool: `icdiff file1.txt file2.txt`. If you require programmatic access, consider running it as a subprocess using `subprocess.run(['icdiff', 'file1.txt', 'file2.txt'], capture_output=True)` or ensure the `icdiff` script is on your Python path and rename it to `icdiff.py` if attempting a direct import, though this is not the intended usage.
This error is generally benign and can often be ignored as the user has already received the desired output (e.g., by quitting `less`). To avoid the error, ensure the receiving process consumes all of `icdiff`'s output or redirects `icdiff`'s output to a file instead of a pipe if you need the full output processed without interruption.
Try running `icdiff` directly in the native Windows Command Prompt (`cmd.exe`) or PowerShell for potentially better results with color support. If using Git, configure `icdiff` as your difftool, but be aware that specific terminal environments like Git Bash might still have limitations. Consider alternative diff tools if compatibility issues persist on your specific Windows setup.
No dependency data recorded yet.