Skip to main content

A semantic code diff tool powered by tree-sitter

Project description

Patchwork

A semantic code diff tool that understands functions, not just lines.

Build Status

[Demo placeholder]

Recording your own demo:

  1. Install asciinema and agg
  2. Run asciinema rec demo.cast
  3. Perform a few diffs (e.g., patchwork diff old.py new.py)
  4. Convert to GIF: agg demo.cast demo.gif

Installation

pip install patchwork-semantic-diff

Usage

1. Compare local files

patchwork diff old.py new.py

2. Compare Git commits

patchwork diff HEAD~1 HEAD path/to/file.js

3. Audit an entire commit

patchwork show HEAD~1

4. Visual TUI mode

patchwork diff old.py new.py --tui

How it Works

Patchwork uses Tree-sitter to parse your source code into an Abstract Syntax Tree (AST). Instead of looking at raw text changes, it traverses the tree to identify specific function declarations, arrow functions, and class methods.

By mapping code changes to these semantic blocks, Patchwork can tell you precisely which functions were added, deleted, or modified. This eliminates the "noise" of line-level diffs—like changes to comments, whitespace, or reordering—and lets you focus on the logic that actually changed.

Supported Languages

Language Extensions
Python .py
JavaScript .js
TypeScript .ts

Contributing

We welcome contributions! Please open an issue or submit a pull request on GitHub.

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

patchwork_semantic_diff-0.1.4.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

patchwork_semantic_diff-0.1.4-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file patchwork_semantic_diff-0.1.4.tar.gz.

File metadata

  • Download URL: patchwork_semantic_diff-0.1.4.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for patchwork_semantic_diff-0.1.4.tar.gz
Algorithm Hash digest
SHA256 a9ddd7b60999a01cdf3a8901957adbe0dbc86fadb38e6105c65b24514c3331f8
MD5 c7f3d11b250968e976dca0d52511145b
BLAKE2b-256 84345d66628852024abfd0f516e4ec67bec09ff445d1eb8a2642f371310bbd5f

See more details on using hashes here.

File details

Details for the file patchwork_semantic_diff-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for patchwork_semantic_diff-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f6b8252de9fda387d624f679276c5219c0312e1b0fa5aabf8c44ce7fc5158099
MD5 8664e244f1ab9c99847c6fc1a3a079df
BLAKE2b-256 2a42f5fe53d24b783e7d88e65b418ac195c5ea4995099d471a010437752fa175

See more details on using hashes here.

Supported by

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