Skip to content

Releases: houfu/redlines

v0.6.1 - One last change for 2025

24 Nov 15:31
996a40d

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.6.0...v0.6.1

v0.6.0

28 Oct 15:45
5d54e93

Choose a tag to compare

🎉 Major Release: AI Agent Optimization & Community Contributions

I'm thrilled to announce Redlines 0.6.0, a significant release that transforms redlines into a powerful tool for AI agents and automation
workflows. This release includes contributions from 8 community contributors during Hacktoberfest 2025!

🤖 Headline Feature: Agent-First Design

Command-Less CLI Invocation

The biggest change in 0.6.0 is the new command-less CLI that outputs JSON by default - the most agent-friendly format:

New in 0.6.0: Just provide two strings or files
redlines "old text" "new text"

Outputs structured JSON automatically
redlines file1.txt file2.txt --pretty

Why this matters:

  • AI agents can now invoke redlines with minimal syntax
  • JSON output provides complete structural information (tokens, positions, statistics)
  • Backward compatible: all existing commands (text, json, markdown, stats) still work

⚠️ Breaking Changes

  1. Default CLI Behavior (PR #76)
  • Command-less invocation now defaults to JSON output (not text/rich format)
  • Impact: If you were relying on implicit behavior, you now need to specify: redlines text "source" "test"
  • Migration: All existing commands with explicit format still work exactly as before
  1. redlines Property Return Type (PR #63)
  • The r.redlines property return type has changed:
    • Before: Returned internal objects (included "equal" operations)
    • After: Returns public Redline dataclass objects (only actual changes)
  • Impact: Minimal - r.redlines was primarily used internally. All rendering methods (output_markdown, output_rich, output_json) continue to work
    unchanged.
  • Migration: If you were accessing r.redlines directly, update code to handle the new Redline dataclass structure
  1. Dependencies
  • Added click-default-group>=1.2.4 as a new dependency (automatically installed)
  • Dropped support for Python 3.8 and 3.9
  • Migrated from Poetry to uv for package management (developers only)

✨ New Features

📊 JSON Output Format (#60, #70)

  • Complete machine-readable diff structure with token and character positions
  • Comprehensive statistics (deletions, insertions, replacements, change ratios)
  • Optional Levenshtein distance support
  • Pretty-print option for debugging

🔤 NupunktProcessor - Advanced Tokenization (#73)

Intelligent sentence boundary detection that handles:

  • Abbreviations (Dr., Mr., Prof., etc.)
  • Decimals and currency ($5.99, 3.14)
  • URLs and email addresses
  • Legal citations and complex punctuation
  from redlines import Redlines
  from redlines.processor import NupunktProcessor

  processor = NupunktProcessor()
  test = Redlines(
      "Dr. Smith said hello. Mr. Jones replied.",
      "Dr. Smith said hi. Mr. Jones replied.",
      processor=processor
  )

Optional dependency: pip install redlines[nupunkt] (Python 3.11+)

📖 Programmatic Diff API (#63)

New structured access to changes:

  • New changes property returns structured Redline dataclass objects
  • Filter changes by type: get_changes(operation="replace")
  • Direct access to source/test text and positions
  • Excludes "equal" operations automatically (only actual changes)
  from redlines import Redlines

  test = Redlines("old text", "new text")

  # Access all changes
  for change in test.changes:
      print(f"{change.operation}: {change.source_text} -> {change.test_text}")

  # Filter by operation type
  replacements = test.get_changes(operation="replace")
  deletions = test.get_changes(operation="delete")

📈 Advanced Statistics (#72)

Contributed by @Kaos599

Comprehensive stats() method with detailed analytics:

  • Character-level statistics (chars added/deleted/net change)
  • Change size metrics (longest, shortest, average)
  • Change ratio calculations
  • Optional Levenshtein distance

stats = test.stats()
print(f"Total changes: {stats.total_changes}")
print(f"Change ratio: {stats.change_ratio:.1%}")
print(f"Longest change: {stats.longest_change_length} chars")
print(f"Levenshtein distance: {stats.levenshtein_distance}")

📝 Agent Integration Guide (#76)

New comprehensive documentation specifically for AI agents:

  • JSON schema reference
  • CLI automation patterns
  • Error handling cookbook
  • Performance guidelines
  • 5 runnable example scripts in examples/

Access via: redlines guide or https://github.com/houfu/redlines/blob/main/AGENT_GUIDE.md

🛠️ Enhanced CLI (#61, #74)

  • File input support (not just strings)
  • New Explicit JSON and stats commands
  • Exit codes for CI/CD integration
  • --quiet flag for stats-only output
  • Smart TTY detection (helpful tips only in interactive terminals)

🎯 Type Safety (#62)

Contributed by @FallenDeity

  • Full mypy type coverage
  • Strict type checking enabled
  • Better IDE autocomplete and error detection

🙏 Community Contributions

This release was made possible by 8 contributors during Hacktoberfest 2025:

  • @FallenDeity (Triyan Mukherjee) - Type safety and mypy coverage
  • @Kaos599 (Harsh) - Advanced statistics and analytics
  • @abbasabro (Abbas Abro) - Bug fixes and improvements
  • @riyadey27 (Riya Dey) - Python version documentation
  • @fasfsfgs (Thiago Almeida) - SyntaxWarning fixes
  • @TharunK123 (Tharun K) - Testing and validation
  • And community testing from multiple contributors!

Thank you all for making redlines better! 🎊

📚 Documentation Updates

  • Condensed and modernized README.md (38% reduction in length)
  • Added Quick Start sections to README and API docs
  • AGENT_GUIDE.md now linked from pdoc documentation
  • Fixed inaccurate descriptions ("underlines" → "highlights")
  • Updated all examples to reflect JSON-first approach
  • Comprehensive benchmarks in demo/ directory

🔧 Technical Improvements

  • Migrated from Poetry to uv for faster dependency resolution
  • Updated Python support: 3.10 - 3.14 (dropped 3.8, 3.9)
  • Improved test coverage with 9 new tests for command-less invocation
  • Better error messages and exit codes
  • Backward compatibility maintained for all rendering methods

🚀 Upgrade Guide

For CLI Users

  # Old way (still works)
  redlines text "old" "new"

  # New way (simpler, same result)
  redlines "old" "new"

  # If you need text/rich output, specify explicitly
  redlines text "old" "new"

  For Python API Users - output_* methods

  No breaking changes! All existing Python code works exactly as before.

  # All existing code works
  from redlines import Redlines
  test = Redlines("old", "new")
  print(test.output_markdown)  # Still works
  print(test.output_rich)      # Still works

For Python API Users - Using r.redlines property

If you were directly accessing the r.redlines property (rare), update to handle the new Redline dataclass:

  # Old way (0.5.x)
  for item in r.redlines:
      # item was internal DiffOperation object
      pass

  # New way (0.6.0)
  for redline in r.redlines:
      # redline is now a public Redline dataclass
      print(redline.operation)      # "delete", "insert", or "replace"
      print(redline.source_text)    # Text from source
      print(redline.test_text)      # Text from test
      print(redline.source_position)  # Position tuple

For Package Maintainers

  • Update minimum dependency: redlines>=0.6.0
  • Note new dependency: click-default-group>=1.2.4 (automatically installed)
  • Optional dependencies: redlines[nupunkt], redlines[levenshtein]

📦 Installation

  # Standard installation
  pip install redlines

  # With advanced sentence detection (Python 3.11+)
  pip install redlines[nupunkt]

  # With Levenshtein distance support
  pip install redlines[levenshtein]

  # All optional features
  pip install redlines[nupunkt,levenshtein]

Thank you for using redlines! 🦖

v0.5.2

22 May 11:52
dc3fd68

Choose a tag to compare

What's Changed

  • Normalize tokens by stripping whitespace for comparison by @rickythefox in #45
  • Refactor redlines for clarity and maintainability by @houfu in #50
  • Project maintenance by @houfu in #49
    • Migration to UV for Dependency Management
      • Replaced Poetry with UV in pyproject.toml, updating dependencies, dev-dependencies, and build system configuration. The build backend was changed from poetry.core.masonry.api to hatchling.build.
      • Updated workflows (docs.yml, python-package.yml, python-publish.yml) to use UV for dependency installation and project setup instead of Poetry
    • GitHub Actions Workflow Updates
    • Documentation and Metadata improvements
      • Updated contact email in CONTRIBUTING.md and Code_of_Conduct.md to <houfu@OUTLOOK dot sg>. Removed references to Matrix chat for community discussions.
      • Removed Matrix chat badge from README.md.
      • Updated copyright in LICENSE.txt to include contributors and extend the range to 2025.

New Contributors 👏 👏 👏

Full Changelog: v0.5.1...v0.5.2

v0.5.1

07 Nov 14:32
894f82e

Choose a tag to compare

A hotfix to correct a regression for Python 3.8

What's Changed

  • Changed type hints from list[str] to List[str] in redlines/processor.py for better consistency with Python's typing module. Closed #42 [Thanks to @servient-ashwin for raising this]
  • Extended the supported Python versions in the CI configuration to include Python 3.8 and 3.12 (.github/workflows/python-package.yml).
  • Added a new CLI command to output redline comparisons as markdown with various style options (redlines/cli.py).
  • New image for Readme.Md etc featuring red-green (the default) output

Full Changelog: v0.5.0...v0.5.1

v0.5

02 Nov 12:46

Choose a tag to compare

A new year, a new version.
v 0.5 introduces several new enhancements and lays the groundwork for future features.

New Features

  • New Markdown styles
    • bbcode (BBCode) (Thanks to new contributor @tharun634 )
    • streamlit
  • CLI utility now has a new command simple_text (Thanks to @jeisner for the inspiration)
  • redlines.compare now support rich output as an option

The bulk of the change goes towards refactoring the current processing into its own processor: WholeDocumentProcessor.
These changes allow these possibilities in the future:

  • Instead of processing all content in a document at once, changes can be generated.
  • Processing content can be customized, for example page by page for PDFs.

Other changes

  • Improved documentation in several areas -- cli (#38), corrections (#27), redlines-textual, README.md etc
  • Added uv
  • New tests for new features

Full Changelog: v0.4.2...v0.5

v0.4.2

03 Sep 16:30
e1ff20c

Choose a tag to compare

What's Changed

Full Changelog: v0.4.1...v0.4.2

v0.4.1

03 Sep 15:55
a5cd3fd

Choose a tag to compare

What's Changed

  • Fix: Update console tests to pass by @houfu in #18
  • Feat: Add "ghfm" style by @houfu in #19
  • added None to be detected for markdown_style by @RamishKH in #22
  • Fix: Add a default test case by @houfu in #23

New Contributors

Full Changelog: v0.4.0...v0.4.1

v0.4.0

13 Jul 15:40
eaa71e1

Choose a tag to compare

In this version:

Much appreciation 👏 to first time contributor @aaAldinaaa and @inteli5 for their assistance in this release.

Your contributions and comments to issues are always welcomed and make it hard for me to ignore this library.

v0.3.0

10 May 14:46
102b396

Choose a tag to compare

In this version:

  • better handling of newlines by @inteli5
  • New workflow, updates to docs and other housekeeping by @houfu

Thanks to @inteli5 first contribution, I felt more compelled to maintain this code. Open source works!
New contributions are always welcomed.