ftw-patch: Unicode-Safe & Whitespace-Aware Patching

PyPI version Documentation Status Code Coverage Doc Coverage Linting: ruff License: GPL v2

ftw-patch is a robust Python-based patch utility designed for modern development workflows. While traditional patch tools often struggle with different line endings, Unicode characters, or minor formatting changes, ftw-patch provides advanced normalization to make patching reliable and predictable.

Key Features

  • Unicode-Safe: Native handling of UTF-8 and other encodings without corruption.

  • Smart Normalization: Optional ignore/normalize rules for non-leading whitespace and blank lines.

  • Context-Aware: Dynamically loads configuration from pyproject.toml or user-defined files.

  • Safety First: Built-in dry-run mode and flexible backup options (including timestamped suffixes).

  • Cross-Platform: Consistent behavior on Linux, macOS, and Windows.

Installation

Developer Installation (pip)

If you intend to use the package as a library or want to contribute to development, use a standard virtual environment:

# Create and activate a venv
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install the package
pip install ftw-patch

Quick Start

Once installed, use the ftwpatch command to apply a unified diff:

ftwpatch my_changes.patch

Documentation

Externel Components

Indices and tables

Licensed under CC BY-NC-SA 4.0 Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International