patch
Library to parse and apply unified diffs
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- No external dependencies, but package is abandoned since 2016-02-13 with no active maintenance.
- 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 · maintenance · safety
MIT License (permissive) — 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.
last release 2016-02-13 (3835 days) · last repo commit 2022-01-25 · 123 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 620,187 downloads/mo, #5,726 on PyPI
Alternatives
Verify before relying
pip install "patch==1.*"
import patch
patch.fromfile('diff.patch')- 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.
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 on this page. Verify before relying on it.
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
patch on PyPI
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.
No external dependencies, but package is abandoned since 2016-02-13 with no active maintenance.
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')
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 | Not specified |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Abandoned 3,835 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 620,187 / month, #5,726 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Programming Language :: Python :: 2Programming Language :: Python :: 3 |
Evidence: patch-1.16.zip
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “apply unified diff patches”
- patchParses and applies unified diff patches to files, with automatic…
- patch-ngParses and applies unified diff patches to files, with automatic…
- moreorlessGenerates unified diffs with correct handling of files without…
Give your agent the search over MCP, or paste the wish link into any chat.
More Build Tools packages
Provides reusable utilities for Python packaging interoperability, including version handling, specifiers, markers, requirements, tags, and metadata parsing according to standards like PEP 440 and PEP 425.
Wraps any iterable to display a real-time progress bar in the terminal or Jupyter notebook, showing iteration count, elapsed time, and estimated time remaining.
pip is the standard installer for Python packages, enabling you to download and install packages from the Python Package Index and other indexes into your Python environment.
Hatchling is a standards-compliant Python build backend that handles packaging, metadata, and distribution of Python projects when configured in a project's pyproject.toml file.
Generates Python gRPC service stubs and message classes from Protocol Buffer definitions, enabling developers to build gRPC clients and servers.
pre-commit is a framework for installing and running git hooks written in any language before commits are made, automating code quality and validation checks across multi-language projects.
Install it if your team needs consistent, automated validation at commit time.
See also bsdiff4 · moreorless · patch-ng · patchy · whatthepatch · diff-match-patch · unidiff2 · unidiff · xmldiff · fast-diff-match-patch