Skip to main content

Features

  • Python 2 and 3 compatible

  • Automatic correction of * Linefeeds according to patched file * Diffs broken by stripping trailing whitespace * a/ and b/ prefixes

  • Single file, which is a command line tool and a library

  • No dependencies outside Python stdlib

  • Patch format detection (SVN, HG, GIT)

  • Nice diffstat histogram

  • Linux / Windows / OS X

  • Test coverage

Things that don’t work out of the box:

  • File renaming, creation and removal

  • Directory tree operations

  • Version control specific properties

  • Non-unified diff formats

Usage

Download patch.py and run it with Python. It is a self-contained module without external dependencies:

patch.py diff.patch

You can also run the .zip file:

python patch-1.16.zip diff.patch

Installation

patch.py is self sufficient. You can copy it into your repository and use it from here. This setup will always be repeatable. But if you need to add patch module as a dependency, make sure to use strict specifiers to avoid hitting an API break when version 2 is released:

pip install "patch==1.*"

Changes

https://github.com/techtonik/python-patch/blob/master/doc/CHANGES.md

Release files for patch 1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for patch 1.16
File Size Uploaded
patch-1.16.zip 12.8 kB Details

Release files / patch-1.16.zip

Download URL patch-1.16.zip
Size 12.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c62073f356cff054c8ac24496f1a3d7cfa137835c31e9af39a9f5292fd75bd9f
BLAKE2b-256 checksum
How to use checksums
da740815f03c82f4dc738e2bfc5f8966f682bebcc809f30c8e306e6cc7156a99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.16 This release

1 release file

1.15

1 release file

1.14.2

1 release file

1.14

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page