v0.5 Release Notes
Main Focus
v0.5 introduced a selectable KLayout Python API backend beside the existing gdstk backend.
The goal was to check whether pya could reproduce the same layout extraction behavior while keeping the downstream workflow unchanged.
GDS/OAS
-> layout backend
-> polygon extraction
-> existing width / space, raster, aerial image, contour, and preview flow
Implementation Summary
The v0.5 work added a backend boundary for layout loading and polygon extraction.
Key changes:
gdstkremained the default backend.pyawas added as a selectable comparison backend.- The downstream contract still used
list[gdstk.Polygon]. - Width / space checks, rasterization, aerial-image generation, contour extraction, preview rendering, and GDS writing were not rewritten at this stage.
- Backend selection was controlled by the
LAYOUT_BACKENDenvironment variable.
Evaluation Summary
For the public tt04_pwm.gds example on layer/datatype 68/20, the extracted polygon set matched between gdstk and pya within numerical noise.
Observed comparison points:
| Metric | Result |
|---|---|
| Top cell | matched |
| Target polygon count | matched |
| Vertex histogram | matched |
| Bounding box | matched |
| Area sum | matched within numerical noise |
| Width marker count | matched |
| Space marker count | matched |
The service ROI could differ because downstream ROI choice was order-sensitive and pya traversal order did not necessarily match gdstk traversal order. This changed the sampled ROI location, not the extracted target geometry.
Runtime and Render Notes
The local comparison showed that gdstk remained faster for raw extraction in the tested case, while pya was useful as a compatibility and validation path.
Render compatibility was reviewed because the standalone klayout package adds a larger native wheel than gdstk. This raised expected build-time and slug-size considerations.
Recommended Backend at v0.5
Recommended backend at this stage: gdstk.
Reason:
pyamatched the tested geometry.gdstkwas faster for extraction in the local comparison.gdstkwas already deployed.- Keeping
pyaas an optional backend reduced deployment risk while preserving a comparison path.
Remaining Limitations
pyaraw extraction was slower in the local comparison.- Polygon traversal order differed between backends.
- Complex polygons with holes required care because the downstream contract expected
gdstk.Polygon. - OAS behavior was wired through
pya.Layout.read, but not fully compared in the sample.