diff-parser
Parse git diff data or .diff file. Access a list of properties including filenames, filepath, source-hash, target-hash and more for every file changed.
What it is and what it does
diff-parser is a lightweight Python library for reading and extracting structured information from diff files. It takes a path to a git diff or .diff file and parses it into blocks, each representing a changed file with accessible properties like old and new filenames, filepaths, source and target hashes, and change type.
The package has no external runtime dependencies and supports Python 3.6 and later. It is intended for developers who need programmatic access to diff metadata—for example, in build tools, code review automation, or version control workflows. The project is dormant but stable; the last commit was 2024-12-30, and no security vulnerabilities have been reported.
Use it for:
- Extract metadata about changed files from git diff output in CI/CD pipelines for conditional build steps.
- Analyze which files were modified in a commit to generate automated reports or trigger downstream tasks.
- Parse .diff files from patch management or code review tools to identify affected modules or dependencies.
- Build tooling that needs to programmatically inspect file changes without shelling out to git commands.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses git diff and .diff files to extract structured metadata about changed files, including filenames, filepaths, source and target hashes, and change type.
Yes, if you need to parse diff files programmatically. The package is simple, dependency-free, and permissively licensed. However, maintenance is dormant—no updates since 2024-09-09—so evaluate whether the feature set meets your needs and whether you can maintain a fork if required. Verify that the available properties are sufficient for your use case.
Install
diff-parser on PyPI
pip
pip install diff-parseruv
uv add diff-parserpoetry
poetry add diff-parserInstalling diff-parser
Before you install
Low install friction with no runtime dependencies. Maintenance is dormant—last commit was 2024-12-30, but the repository remains active and the package has received no updates since its 2024-09-09 release.
License in practice
MIT License permits unrestricted use, modification, and redistribution with minimal restrictions, making it suitable for both open-source and commercial projects.
Quickstart
pip install diff-parser
from diff_parser import Diff
diff = Diff("path/to/diff/file.diff")
for block in diff:
print(block.new_filename)
print(block.source_hash)
print(block.target_hash)
print(block.type)
Requires Python 3.6 or later.
Verify before relying
- Whether the package handles edge cases in diff format variations beyond git diff.
- Performance characteristics when parsing large diff files or many files in sequence.
- Current state of the 'content' field, which documentation notes is 'to be implemented'.
Package facts
| License | MIT License Copyright (c) 2024 Shaik Abdus Samad Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | dormant — 704 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 237,843/month — #8,952 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: diff_parser-1.1-py3-none-any.whl
Keywords: diff, file differences, diff parser, diffparser, diff file, git diff
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
xmldiffxmldiff compares two XML files or trees and…
permissive · top 15,000 on PyPI
unidiff2Parses unified diff format into structured…
permissive · top 15,000 on PyPI
gitignorefileParses `.gitignore` files according to Git's…
permissive · top 15,000 on PyPI
dictdifferDictdiffer computes and applies diffs and…
permissive · top 5,000 on PyPI
unidiffParses unified diff format data into structured…
permissive · top 1,000 on PyPI
csv-diffCompares two CSV, TSV, or JSON files and…
permissive · top 15,000 on PyPI
jsondiffComputes structured diffs between JSON and…
permissive · top 5,000 on PyPI
gitignore-parserParses .gitignore files and returns a callable…
permissive · top 5,000 on PyPI
patchParses and applies unified diff patches to…
permissive · top 15,000 on PyPI
openstep-parserParses Xcode project files (OpenStep format)…
permissive · top 15,000 on PyPI