Skip to main content

Compares ASTs of Python files that have been changed in git

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-compare-ast-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

python_compare_ast-1.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file python-compare-ast-1.0.0.tar.gz.

File metadata

  • Download URL: python-compare-ast-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for python-compare-ast-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d65bd3dee59f2ea7012aa01d7c6ed52736a2ed9e8cdf47b3d603849d9b859ca8
MD5 966a0f3ca11cde5a0a56b2e7154b0075
BLAKE2b-256 d044fac97aff33a3b3fcbf2a6a9edd2d922766c884e80b5dc5a32684330ccb17

See more details on using hashes here.

File details

Details for the file python_compare_ast-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: python_compare_ast-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for python_compare_ast-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f456cc15c60cae6085b8fe46ffcc49d21e52583169d8e32f8893575638586cda
MD5 bde3f42bf912d55bf22bf76e8ee7748e
BLAKE2b-256 473d60b77dcffca0fff80d0b96cf99e90b59316c92e12b1cde53778b39d61157

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page