skillfed

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.

diff-parser v1.1 237.8K downloads/30d#8,952 on PyPI4
Permissive 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) DORMANT released

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-parser

uv

uv add diff-parser

poetry

poetry add diff-parser

Installing 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

Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Build Tools

Tags

parse diff filesgit diff parserextract diff metadatadiff file analysisparse .diff formatgit change extractiondiff file reader
diff-parsinggit-utilitiesbuild-tools

More Build Tools packages