Registry / serialization / redlines

redlines

JSON →
library0.6.1pypypiunverified

Redlines is a Python library that compares two strings or blocks of text, producing human-readable differences or 'deltas' similar to Microsoft Word's track changes. It provides structured output showing detailed change information, positions, and statistics, supporting various formats like JSON (default for CLI), Markdown, HTML, and rich terminal display. The current version is 0.6.1, and the project exhibits an active release cadence.

pip install redlines
INSTALL
IMPORT
SIG · REDLINES
R
redlines
serializationpythonv0.6.1
Install
3.2s avg
Import
80ms
Disk
43MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v0.6.1 · 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.10–3.960 runs
installs and imports cleanly · install 0.0s · import 0.036s · 52MB
glibc
py 3.10–3.960 runs
installs and imports cleanly · install 3.2s · import 0.027s · 45MB
43MB installed
● package 43MB
Code
Verified usage

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

redlines
✓ from redlines import Redlines
✗ import redlines

Instantiate the `Redlines` class with two strings to compare. The class provides methods like `output_markdown`, `output_json`, and `output_rich` for different output formats. The `compare` method can be used for subsequent comparisons against the initial 'old' text.

from redlines import Redlines old_text = "The quick brown fox jumps over the lazy dog." new_text = "The quick brown fox walks past the lazy cat." # Create a Redlines object comparator = Redlines(old_text, new_text) # Get markdown output with <del>/<ins> tags markdown_output = comparator.output_markdown print(f"Markdown Output:\n{markdown_output}\n") # Get JSON output (structured data) json_output = comparator.output_json() print(f"JSON Output:\n{json_output}\n") # Example of using the compare method for multiple comparisons alternate_new_text = "The quick brown fox sleeps near the lazy dog." compare_output = comparator.compare(alternate_new_text) print(f"Comparison with alternate text:\n{compare_output}")
redlines --version
Debug
Known issues
breakingThe command-line interface (CLI) behavior changed significantly in v0.6.0. It is now command-less by default and outputs JSON. Previous versions might have had different default outputs or required specific subcommands.
fix
Review the official 'Agent Integration Guide' or run `redlines --help` for the new CLI syntax. Expect JSON output by default when calling `redlines "old text" "new text"`.
affects: >=0.6.0
gotchaThis `redlines` library is for comparing general text strings. There is a similarly named, but distinct, `Python-Redlines` project (not on PyPI) focused specifically on `.docx` file comparison. Ensure you are installing the correct library for your use case.
fix
Verify the PyPI page and documentation to confirm `redlines` (pypi.org/project/redlines) is the correct library for generic text comparison, not `.docx` files.
affects: All versions
gotchaAdvanced features like intelligent sentence detection (for Python 3.11+) and Levenshtein distance statistics require installing optional dependencies using `pip install redlines[nupunkt]` or `pip install redlines[levenshtein]` respectively. These features are not available with a basic `pip install redlines`.
fix
Install the library with the appropriate extra, e.g., `pip install redlines[nupunkt]` to access `NupunktProcessor` for advanced tokenization.
affects: All versions
Upgrade
Version history
0.6.1latest on PyPI · released Nov 24, 2025
Audit
Dependencies
pythonrequiredRuntime environment
nupunktoptionalOptional: Advanced sentence detection
python-LevenshteinoptionalOptional: Levenshtein distance statistics
Agent activity
23 hits · last 30 days
node
22
Resources
redlines — pip install redlines · libregistry