Skip to main content

pyff: Python Diff

Python Diff compares two versions of Python code (modules, packages, directories containing Python modules and/or packages) and detects syntactical and semantical differences between them.

Build Status Maintainability Codacy Badge Coverage Status

Installation

You can install pyff from Python Package Index as pythodiff (unfortunately, a name pyff was taken already):

pip install pythondiff

Usage

You can run pyff to compare two Python modules:

pyff old.py new.py

For comparing Python packages, there is the pyff-package executable:

pyff-package old_package new_package

You can also compare directories using the pyff-dir executable. In this case, pyff finds all Python content in both directories (recurively) and compares everything it finds:

pyff-dir old_directory new_directory

Finally, pyff-git can compare Python content between two revisions in a given Git repository. As with the pyff-dir case, this finds all Python content in the repository.

pyff-git https://github.com/petr-muller/pyff.git master^ master

Development

The development of pyff is far from complete: most of the basic features (code elements being removed, changed or added) are there but not all of them. Some Python code can also confuse pyff or even make it crash. PRs or issue reports are happily accepted.

pyff is written using a modern (3.6+) Python version and has both unit and integration tests. The unit test coverage goal is 100% but it is OK to not cover some elementary (or really hard to unit-test) code, provided the code is marked with a # pragma: no cover comment. pytest is used as a unit test driver. All code is statically checked with Pylint and also annotated with Python type hints. The mypy checker is used to check them. You can install all necessary test requirements using pip:

pip install -r requirements-tests.txt

There are shell helpers in helpers/helpers.sh that make executing all checks easier:

$ . helpers/helpers.sh
$ ft # Fast Test: run just unit tests, without pylint and mypy checks
$ st # Slow Test: run all (unit and integration) tests, pylint and mypy

The integration tests are executed using an excellent clitest tool.

Future

pyff is a pre-1.0.0 version: basically a toy project of mine. A brief list of TODOs for me to consider doing a 1.0.0 version is in #19. My idea is to bring pyff to a small GitHub PR-commenting bot that would comment PRs to Python repositories with a nice, human-readable summary of changes.

Release files for pythondiff 0.7.0

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

Source distribution (sdist)

Source distribution for pythondiff 0.7.0
File Size Uploaded
pythondiff-0.7.0.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pythondiff 0.7.0
File Interpreter ABI Platform
pythondiff-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 42.3 kB

Release files / pythondiff-0.7.0.tar.gz

Download URL pythondiff-0.7.0.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
39ede1a5848b6ea188a806d330c654504ba822c22914af0509925a25eb15bcbe
BLAKE2b-256 checksum
How to use checksums
4ed2ecec600129434e450d5474f8f08031cbd1be8785f806f0c21f842578923a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / pythondiff-0.7.0-py3-none-any.whl

Download URL pythondiff-0.7.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ce88257bf229e7ff8ea9b52c4fdad6e9e857dc7ecbf046d2c273dcae0adebf1b
BLAKE2b-256 checksum
How to use checksums
85e97528985b0eb03da10b7b7015c75425be285324cdb0381358413d64741c7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.2

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

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