--- id: patch version: "1.16" license: MIT License license_treatment: permissive maintenance: abandoned --- # patch — Library to parse and apply unified diffs License: permissive · Maintenance: abandoned · Downloads: 620.2K/mo ## What it is and what it does Patch is a lightweight library and command-line tool that reads unified diff files and applies them to source code. It handles common diff problems automatically—correcting line endings to match the target file, fixing diffs broken by trailing whitespace stripping, and normalizing a/ and b/ path prefixes. It detects patch format from SVN, HG, or GIT sources and produces a diffstat histogram of changes applied. The package is self-contained: a single Python file with no external dependencies beyond the standard library, designed to be copied into a repository or run directly as a zip archive. It works across Linux, Windows, and OS X. However, it does not support file renaming, creation, removal, directory tree operations, or version control–specific properties; it also cannot parse non-unified diff formats. Use it for: - Apply code patches in build systems or deployment scripts without requiring external utilities. - Parse and validate unified diffs programmatically within Python tools or CI/CD pipelines. - Correct malformed patches by automatically fixing whitespace and linefeed issues before application. - Embed patch application logic in a single-file distribution without adding external dependencies. - Generate and display diffstat summaries for patch review or logging. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Parses and applies unified diff patches to files, with automatic correction of linefeeds, whitespace issues, and diff format variations across SVN, HG, and GIT. No. The package is abandoned (last release 2016-02-13, no active maintenance) and poses compatibility and support risk. While its zero-dependency design and permissive license are attractive, the stalled development means unaddressed bugs and uncertain Python 3 compatibility. For new projects, seek actively maintained alternatives; for legacy code already depending on it, pin the version strictly and test thoroughly. ## Install pip install patch uv add patch poetry add patch ## Installing patch Before you install: High install friction: the package is abandoned (last release 2016-02-13, last commit 2022-01-25) with no active maintenance. The single-file design and zero runtime dependencies mean installation itself is straightforward, but the stalled development poses risk for unaddressed bugs. License in practice: MIT License permits free use, modification, and distribution with minimal restrictions, making it suitable for both open-source and commercial projects provided the license notice is retained. Quickstart: pip install "patch==1.*" import patch patch.fromfile('diff.patch') No external dependencies, but package is abandoned since 2016-02-13 with no active maintenance. Verify before relying: - Whether the package remains compatible with current Python 3 versions beyond those tested at release. - Whether file renaming, creation, removal, and directory operations are genuinely unsupported or simply untested. - Current real-world usage patterns and whether the 620187 monthly downloads reflect active use or legacy dependents. ## Package facts - License: MIT License (permissive) - Python support: unspecified - Install friction: high - Maintenance: abandoned - Downloads: 620.2K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags apply unified diff patches, parse patch files, diff file patching, unified diff parser, patch application library, diff format correction, cross-platform patching, diff-patching, abandoned [View on SkillFed](https://skillfed.io/packages/patch) · [View on PyPI](https://pypi.org/project/patch/)