Registry / testing / icdiff

icdiff

JSON →
library2.0.10pypypi✓ verified 35d ago

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.

testing
Install & Compatibility
Where this runs
tested against v2.0.10 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.930 runs
installs and imports cleanly · install 0.0s · import 0.037s · 17.9MB
glibc
py 3.103.930 runs
installs and imports cleanly · install 1.5s · import 0.029s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This is the main class for programmatic diff generation with console-style output.

from icdiff import ConsoleDiff

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.

from icdiff import ConsoleDiff old_text = [ "line 1: hello world", "line 2: foo bar", "line 3: baz qux" ] new_text = [ "line 1: hello earth", "line 2: foo baz", "line 3: baz qux", "line 4: new line" ] differ = ConsoleDiff( cols=80, # Specify number of columns for display line_numbers=True, # Show line numbers color=True # Enable color output ) diff_lines = differ.make_table( old_text, new_text, fromfile='old_version.txt', tofile='new_version.txt', context=True # Show context lines ) for line in diff_lines: print(line)
icdiff --version
Debug
Known footguns
gotcha`icdiff` is primarily a command-line tool. While it offers a Python API, its main strength is interactive visualization. For purely programmatic diff parsing or generating diffs in non-console contexts, Python's built-in `difflib` might be more suitable or efficient, especially if raw diff data (not colored output) is needed.
gotchaThe `fromfile` and `tofile` arguments in `ConsoleDiff.make_table()` are purely for display labels in the diff header (e.g., `--- old_version.txt`). They do not instruct `icdiff` to read content from actual files. You must provide the file content as lists of strings.
gotchaBy default, `ConsoleDiff` tries to output ANSI color codes. If you redirect `icdiff`'s output to a file or pipe it to another command, you might end up with escape codes in the output. While `icdiff`'s CLI often detects non-TTY, the Python API might require explicit handling.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
14 hits · last 30 days
gptbot
4
ahrefsbot
4
claudebot
4
googlebot
1
chatgpt-user
1
Resources