A semantic code diff tool powered by tree-sitter
Project description
Patchwork
A semantic code diff tool that understands functions, not just lines.
[Demo placeholder]
Recording your own demo:
- Install
asciinemaandagg- Run
asciinema rec demo.cast- Perform a few diffs (e.g.,
patchwork diff old.py new.py)- 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, .jsx |
| TypeScript | .ts, .tsx |
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file patchwork_semantic_diff-0.1.5.tar.gz.
File metadata
- Download URL: patchwork_semantic_diff-0.1.5.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a2cdacb8977112b628d7c0e60c2c366267fbe77e43a6ccfa5b313ff413829df
|
|
| MD5 |
9e9c9ef2c0f774c09a2c17c0da921ee1
|
|
| BLAKE2b-256 |
9efdcf4ef377410a5f3528e3f691886210adb39267349480d14ba67231970c9f
|
File details
Details for the file patchwork_semantic_diff-0.1.5-py3-none-any.whl.
File metadata
- Download URL: patchwork_semantic_diff-0.1.5-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3d7e61f2a0fd5b299b4709a10005b31d737798e3cf0e53994b2e214dc516675
|
|
| MD5 |
e9095b04a4feaca3c74a5d98bd1203ce
|
|
| BLAKE2b-256 |
4a170851bb7f93efd09eeaee72f61d2f1de7c5ae39d645b0c1637ffff0485ded
|