redlines
Compare text, and produce human-readable differences or deltas which look like track changes in Microsoft Word.
What it is and what it does
Redlines is a text-comparison library that identifies and visualizes differences between two strings or documents. It produces output formatted like Microsoft Word's track changes, making edits immediately visible with strike-throughs for deletions and highlights for additions. The library supports multiple output formats—JSON (with structured change data and statistics), Markdown, HTML, and rich terminal display—allowing both human-readable visualization and programmatic access to change metadata.
The package provides a single `Redlines` class for comparison work, available both as a Python API and a command-line tool. It includes optional advanced processors: `NupunktProcessor` for intelligent sentence-level tokenization (useful for documents with abbreviations, URLs, and citations) and support for additional statistics via the levenshtein dependency. The library targets Python 3.10 and later and depends on click and rich for CLI and terminal rendering.
Use it for:
- Visualize edits in legal or technical documents where precise change tracking is required.
- Generate structured JSON diffs for AI agents or automation systems to process and act on text modifications.
- Display side-by-side or inline text changes in web applications or documentation tools using HTML or Markdown output.
- Compare versions of configuration files, code comments, or documentation to audit what changed between revisions.
- Integrate with ChatGPT or other LLM workflows to show users exactly what text transformations an AI made.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Redlines compares two strings or text documents and produces structured output showing differences with strike-throughs and highlights, similar to Microsoft Word's track changes, in JSON, Markdown, HTML, or terminal-rich formats.
Yes. Redlines is actively maintained, has no known vulnerabilities, installs with low friction, and solves a specific problem (text comparison with Word-like track changes) that is not trivial to implement from scratch. The MIT license poses no restrictions. Install it if you need to compare text and display or process the differences programmatically.
Install
redlines on PyPI
pip
pip install redlinesuv
uv add redlinespoetry
poetry add redlinesInstalling redlines
Before you install
Low friction: pure Python wheel with four lightweight runtime dependencies (click, click-default-group, rich, rich-click). Repository is active with recent commits and no archived status.
License in practice
MIT license permits unrestricted use, modification, and distribution with minimal attribution requirements—suitable for commercial and proprietary projects.
Quickstart
pip install redlines
from redlines import Redlines
test = Redlines(
"The quick brown fox jumps over the lazy dog.",
"The quick brown fox walks past the lazy dog.",
markdown_style="none"
)
print(test.output_markdown)
Requires Python 3.10 or later; Python 3.8 and 3.9 support has been dropped.
Verify before relying
- Performance characteristics and scalability limits for very large documents are not specified in the fact sheet.
- Whether optional dependencies (nupunkt, levenshtein) are automatically installed or must be explicitly requested.
- Exact behavior and output format differences between the four supported output modes (JSON, Markdown, HTML, rich).
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — click-default-group, click, rich-click, rich |
| Maintenance | actively maintained — 263 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 220,534/month — #9,298 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: redlines-0.6.1-py3-none-any.whl
Keywords: cli, diff, document-comparison, redlines, text-comparison, track-changes
Tags
More Text Processing packages
A drop-in replacement for Python's standard…
permissive · top 100 on PyPI
pyparsingpyparsing provides a library for building text…
permissive · top 1,000 on PyPI
docutilsDocutils converts plaintext documentation in…
unclear · top 1,000 on PyPI
RapidFuzzRapidFuzz provides fast fuzzy string matching…
permissive · top 1,000 on PyPI
tinycss2tinycss2 parses CSS strings into token and…
permissive · top 1,000 on PyPI
llama-parseLlamaParse parses complex documents (PDFs,…
permissive · top 1,000 on PyPI
json-diffCompares two JSON files and generates a JSON…
permissive · top 15,000 on PyPI
xmldiffxmldiff compares two XML files or trees and…
permissive · top 15,000 on PyPI
pyjsonCompares the similarity between two JSON files…
permissive · top 15,000 on PyPI
rouge-scoreComputes ROUGE scores (ROUGE-N, ROUGE-L,…
permissive · top 5,000 on PyPI
recursive-diffRecursively compares two Python data structures…
permissive · top 15,000 on PyPI
ydiffYdiff displays colored, incremental diffs in a…
permissive · top 15,000 on PyPI
markdown2Converts Markdown text to HTML using a fast,…
permissive · top 5,000 on PyPI
rich-rstRenders reStructuredText documents as Rich…
permissive · top 1,000 on PyPI
rensaRensa computes MinHash signatures for fast…
permissive · top 15,000 on PyPI
titlecaseConverts text to title case with intelligent…
permissive · top 15,000 on PyPI