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-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.0.tar.gz (9.9 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.0-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: patchwork_semantic_diff-0.1.0.tar.gz
  • Upload date:
  • Size: 9.9 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.0.tar.gz
Algorithm Hash digest
SHA256 883a0d446bfc517c83d35666972a0fed94a6e6f6c56136d0a517dcd342b2509f
MD5 fc4265eef5e4e063dbcaf04572e8b9c1
BLAKE2b-256 5faa096a5049358378fabb4dd61aa370bcb9fb10e355a4e7dc234e1a67a125e1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for patchwork_semantic_diff-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fb679686660f911ef795edb6d7ebf535e52b6717694db2e241de11dce203ab96
MD5 e54f5d59bd560a9e47512ae4b9da1909
BLAKE2b-256 c991746990ed5137dcf5592513893865719b6a2ec9ed5f188bfbcb6c4c17f178

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