unidiff2
Unified diff parsing/metadata extraction library.
Decision gist · record as of 2026-08-14
Yes, if you need to parse unified diffs in Python and want a dependency-free solution. The low install friction and permissive license are advantages. However, the package is very new (first release October 2025) and aging maintenance status means you should verify that it meets your stability expectations and that the original unidiff project hasn't resumed active development before committing to it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction—pure Python wheel with no runtime dependencies.
- Maintenance status is aging: last commit was 2025-11-03 and the package is only a few months old (first release 2025-10-03), so long-term stability is unproven.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.
last release 2025-10-30 (288 days) · last repo commit 2025-11-03 · 1 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 196,523 downloads/mo, #9,784 on PyPI
Alternatives
Verify before relying
pip install unidiff2
from unidiff import PatchSet
patch = PatchSet.from_filename('file.diff', encoding='utf-8')
for patched_file in patch:
print(f"{patched_file.path}: +{patched_file.added} -{patched_file.removed}")- Whether this fork is actively maintained long-term or if the original unidiff package has resumed development
- Performance characteristics when parsing very large diff files
- Compatibility with edge cases in diff formats from different tools (e.g., Mercurial, Bazaar, Subversion)
What it is and what it does
unidiff2 is a Python library that parses unified diff format (the standard output of `git diff`, `patch` files, and similar tools) into a structured object model. It lets you programmatically inspect which files changed, how many lines were added or removed, access individual hunks and their line-by-line content, and regenerate diff output from the parsed structure.
The package is a maintained fork of the original unidiff library. It has no external runtime dependencies and supports Python 3.7 through 3.11. You can load diffs from files, file-like objects, or iterables, and optionally parse metadata-only for efficiency. It also provides a command-line tool to summarize diff statistics.
Use it for
- Analyze git diffs programmatically in CI/CD pipelines to enforce code review policies or generate reports
- Parse patch files to determine which files and functions were modified without applying the patch
- Build tooling that needs to understand the structure of code changes (e.g., impact analysis, test selection)
- Extract and display diff statistics in a custom format or dashboard
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to parse unified diffs in Python and want a dependency-free solution.
The low install friction and permissive license are advantages. However, the package is very new (first release October 2025) and aging maintenance status means you should verify that it meets your stability expectations and that the original unidiff project hasn't resumed active development before committing to it in production.
Install
unidiff2 on PyPI
Before you install
Low friction—pure Python wheel with no runtime dependencies. Maintenance status is aging: last commit was 2025-11-03 and the package is only a few months old (first release 2025-10-03), so long-term stability is unproven.
License in practice
MIT license is permissive; you can use, modify, and distribute this package with minimal restrictions, provided you retain the license notice.
Quickstart
pip install unidiff2
from unidiff import PatchSet
patch = PatchSet.from_filename('file.diff', encoding='utf-8')
for patched_file in patch:
print(f"{patched_file.path}: +{patched_file.added} -{patched_file.removed}")
Verify before relying
- Whether this fork is actively maintained long-term or if the original unidiff package has resumed development
- Performance characteristics when parsing very large diff files
- Compatibility with edge cases in diff formats from different tools (e.g., Mercurial, Bazaar, Subversion)
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.7 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 288 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 196,523 / month, #9,784 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9 |
Evidence: unidiff2-0.7.8-py3-none-any.whl
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 › “parse unified diff format”
- unidiff2Parses unified diff format into structured Python objects…
- unidiffParses unified diff format data into structured Python objects,…
- patchParses and applies unified diff patches to files, with automatic…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also unidiff · patch · whatthepatch · types-unidiff · moreorless · patch-ng · diff-parser · diff-match-patch · icdiff · reqif