Skip to main content

Diff tool for Gerber/Excellon PCB files: visual raster overlays and attributed vector-geometry change analysis

Project description

gerberdiff

CI PyPI Python License: Apache-2.0

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

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 Warning diagnostic but no geometry.
  • Deprecated RS-274X commands (%MI%, %OF%, %SF%, %AS%): ignored with an Info diagnostic.
  • 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.

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

gerberdiff-0.29.1.tar.gz (2.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gerberdiff-0.29.1-py3-none-any.whl (82.7 kB view details)

Uploaded Python 3

File details

Details for the file gerberdiff-0.29.1.tar.gz.

File metadata

  • Download URL: gerberdiff-0.29.1.tar.gz
  • Upload date:
  • Size: 2.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gerberdiff-0.29.1.tar.gz
Algorithm Hash digest
SHA256 5080e80a41f4a9d4ef57a806559e914b39d226f7a78acb3099a33055211214e2
MD5 79f5b8c86bfba2dd5a36539f8c76e4a8
BLAKE2b-256 43a95f43af79cac0aa8e8e7cbff305277786f140ae723dbc6221a8a9389d298a

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerberdiff-0.29.1.tar.gz:

Publisher: release.yml on CameronBrooks11/gerberdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file gerberdiff-0.29.1-py3-none-any.whl.

File metadata

  • Download URL: gerberdiff-0.29.1-py3-none-any.whl
  • Upload date:
  • Size: 82.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for gerberdiff-0.29.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fe3bfeb31971dd1d3550e79c3495cdbe8f8692b210f4c377b68ad0d96f2c2f5d
MD5 0a57f031b9db7b76de73ec88bfad5722
BLAKE2b-256 c2061e069d5d45beb0a7932db36bafd12c87f9f7e1a8f8b1e7b66e8f0a64e8e1

See more details on using hashes here.

Provenance

The following attestation bundles were made for gerberdiff-0.29.1-py3-none-any.whl:

Publisher: release.yml on CameronBrooks11/gerberdiff

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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