gerberdiff
Diff tool for Gerber/Excellon PCB design files, with two complementary engines:
- Raster diff (
diff) -- visual overlay PNGs of changed pixels. - Geometry diff (
geomdiff) -- resolution-independent, attributed changes (moved/resized/added/removed) computed on the parsed vector geometry, down to micrometre displacements.
Install
pip install gerberdiff
Requires Python >= 3.11. The raster engine needs the system Cairo library
(libcairo2 on Debian/Ubuntu, cairo via Homebrew); the geometry engine
is Cairo-free.
Quick start
# Geometry diff: what moved, resized, was added or removed -- and by how much
gerberdiff geomdiff before/ after/ --out-json report.json --out-svg overlays/
# Raster diff: visual overlay PNGs
gerberdiff diff before/ after/ --out-json report.json --out-png diffs/
# Exit 1 if any changes detected (useful in CI)
gerberdiff geomdiff before/ after/ --fail-on-diff
import gerberdiff
from pathlib import Path
result = gerberdiff.compute_geometry_diff(Path("before/"), Path("after/"))
for layer in result.layers:
for change in layer.changes:
print(f"{layer.name}: {change.kind} {change.op_kind} "
f"dx={change.dx_mm} dy={change.dy_mm}")
Docs
Full documentation site: https://heibench.com/gerberdiff/
| Topic | File |
|---|---|
| CLI reference | docs/cli.md |
| Python API | docs/api.md |
| JSON report schemas | docs/schema.md |
| Architecture | docs/architecture.md |
| Geometry diff engine | docs/geometry-diff.md |
Known limitations
- Excellon rout mode: only drill hits are processed; routing paths produce a
Warningdiagnostic but no geometry. - Deprecated RS-274X commands (
%MI%,%OF%,%SF%,%AS%): ignored with anInfodiagnostic. - Rectangle/obround aperture strokes: the raster engine strokes with
max(width, height); the geometry engine computes the exact Minkowski sum for linear strokes (see docs/geometry-diff.md).
Development
See CONTRIBUTING.md.
Metadata
Release files for gerberdiff 0.30.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gerberdiff-0.30.0.tar.gz | 2.2 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gerberdiff-0.30.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 2.3 MB
Release files / gerberdiff-0.30.0.tar.gz
| Download URL | gerberdiff-0.30.0.tar.gz |
|---|---|
| Size | 2.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e51374846581c6bf327f3788ac9ae0c142a7969697a9a8ff7a85fb81606a323b
|
|
BLAKE2b-256 checksum How to use checksums |
6f133c98fb1985faa8af580db09d062c6f27f5303dbb043a8d2920bbacb4827a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / gerberdiff-0.30.0-py3-none-any.whl
| Download URL | gerberdiff-0.30.0-py3-none-any.whl |
|---|---|
| Size | 86.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7cc5fcb9bdfeb4019b034f64b6e4ed5ae153599a299588af3ef757718b4f732c
|
|
BLAKE2b-256 checksum How to use checksums |
030a1d13d5b422badf7c36325d517ef1756fa97bf0d4834a7c4795e5a41a190d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency log