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, .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

patchwork_semantic_diff-0.1.5.tar.gz (11.2 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.5-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

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

Hashes for patchwork_semantic_diff-0.1.5.tar.gz
Algorithm Hash digest
SHA256 7a2cdacb8977112b628d7c0e60c2c366267fbe77e43a6ccfa5b313ff413829df
MD5 9e9c9ef2c0f774c09a2c17c0da921ee1
BLAKE2b-256 9efdcf4ef377410a5f3528e3f691886210adb39267349480d14ba67231970c9f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for patchwork_semantic_diff-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f3d7e61f2a0fd5b299b4709a10005b31d737798e3cf0e53994b2e214dc516675
MD5 e9095b04a4feaca3c74a5d98bd1203ce
BLAKE2b-256 4a170851bb7f93efd09eeaee72f61d2f1de7c5ae39d645b0c1637ffff0485ded

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