Skip to main content

python-compare-ast

Compares ASTs of Python files that have been changed in git.

Useful for checking if formatting changes do not modify the behaviour of the source code.

Requirements

Python 3.6 or newer.

Installation

$ pip install python-compare-ast

Usage

$ python-compare-ast [--git-dir <path_to_git_working_dir>]

git-dir defaults to the current directory.

Example output:

$ git clone https://github.com/pallets/click.git
$ python-compare-ast --git-dir click
Analysing /absolute/path/to/click/.git
Repo is clean, comparing changes in latest commit (dfb842d95a7c146d8fe8140c8100065410d95c4d).
warning: AST does not match for src/click/core.py
warning: AST does not match for tests/test_options.py
Found 2 AST differences.

If the git working directory is clean, the files changed in latest commit will be analysed. If the git working directory is dirty, the dirty files will will analysed. If no changed files has a different AST then before, python-compare-ast will exit with status code 0. However, if there are changes to the AST the exit code will be 1.

Metadata

Release files for python-compare-ast 1.0.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 python-compare-ast 1.0.0
File Size Uploaded
python-compare-ast-1.0.0.tar.gz 5.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-compare-ast 1.0.0
File Interpreter ABI Platform
python_compare_ast-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.2 kB

Release files / python-compare-ast-1.0.0.tar.gz

Download URL python-compare-ast-1.0.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d65bd3dee59f2ea7012aa01d7c6ed52736a2ed9e8cdf47b3d603849d9b859ca8
BLAKE2b-256 checksum
How to use checksums
d044fac97aff33a3b3fcbf2a6a9edd2d922766c884e80b5dc5a32684330ccb17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

Release files / python_compare_ast-1.0.0-py3-none-any.whl

Download URL python_compare_ast-1.0.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f456cc15c60cae6085b8fe46ffcc49d21e52583169d8e32f8893575638586cda
BLAKE2b-256 checksum
How to use checksums
473d60b77dcffca0fff80d0b96cf99e90b59316c92e12b1cde53778b39d61157
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.1.post20200529 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.6.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

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