Skip to content

Instantly share code, notes, and snippets.

@urish
Created September 8, 2025 12:54
Show Gist options
  • Save urish/6245c237432ed5aa141b67a8d9da9c28 to your computer and use it in GitHub Desktop.
Save urish/6245c237432ed5aa141b67a8d9da9c28 to your computer and use it in GitHub Desktop.
gds_compare.py
# Usage:
# klayout -b -r gds_compare.py -rd gds1=file1.gds -rd gds2=file2.gds
import sys
import pya
def compare_gds(file1, file2):
diff = pya.LayoutDiff()
# Load the layouts
layout1 = pya.Layout()
layout1.read(file1)
layout2 = pya.Layout()
layout2.read(file2)
# Check if the layouts are identical
return diff.compare(layout1, layout2)
if __name__ == "__main__":
if compare_gds(gds1, gds2): # noqa: F821
sys.exit(0)
else:
sys.exit(-1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment