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.1.tar.gz (10.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.1-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: patchwork_semantic_diff-0.1.1.tar.gz
  • Upload date:
  • Size: 10.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.1.tar.gz
Algorithm Hash digest
SHA256 d293cc8a6af7811dfe9e39fe841e028c67047fa8c4ff155a73db0d91867d91d6
MD5 d842832564c2770c4bdea4413177b896
BLAKE2b-256 38c57bd94d41c0a88b7691dd01a26a3ac33ead50ef39812d7af10dbd0e822b35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for patchwork_semantic_diff-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e6e4060fe6fee5f054c8e4d62e1fdaab349f794cc6ef68ae4679d5273c5f63e4
MD5 7ea9e398cc915d65c6dfab06cef5da1b
BLAKE2b-256 2dd8e798c5b0f62c434bdc7580e0bff5c40e1144b7fb9a8c2e04b2695c9b8a1e

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