feat(tidy3d): FXC-3982-support-lydrc-in-klayout-plugin #2961
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, we only support .drc files for the DRC Runner in the DRC Config in the klayout plugin. This PR simply allows also “lydrc” suffixes in the validator.
Greptile Overview
Updated On: 2025-11-05 11:18:46 UTC
Greptile Summary
Extended KLayout DRC plugin to support
.lydrcfile format in addition to.drcfiles..lydrcfiles are XML-wrapped DRC runsets that KLayout can process.Key Changes
SUPPORTED_DRC_SUFFIXESconstant containing both.drcand.lydrcsuffixes_validate_drc_runset_filetypevalidator to accept both file types.drcand XML-wrapped.lydrccontentTest Coverage
wrap_drc_to_lydrchelper method to generate XML-wrapped contentdrc_file_suffixto test both.drcand.lydrcformatsIssues Found
.drcformat (needs update)Confidence Score: 4/5
.lydrcto the supported suffixes set and updating the validator. The regex patterns work correctly for both formats since they search for the DRC commands in the file content regardless of XML wrapping. Comprehensive test coverage added. Score is 4 (not 5) due to outdated docstring and missing CHANGELOG entry per repository guidelines.tidy3d/plugins/klayout/drc/drc.pyneeds docstring update on line 59, and CHANGELOG.md needs an entryImportant Files Changed
File Analysis
.lydrcsupport to DRC validator by updating constant and validation logic; docstring needs update.lydrcformat with XML wrapper helper and parametrized testsSequence Diagram
sequenceDiagram participant User participant DRCRunner participant DRCConfig participant Validator participant KLayout User->>DRCRunner: run(source, drc_runset) DRCRunner->>DRCConfig: create config DRCConfig->>Validator: _validate_drc_runset_filetype(path) alt file suffix is .drc or .lydrc Validator-->>DRCConfig: valid else file suffix is other Validator-->>DRCConfig: ValidationError end DRCConfig->>Validator: _validate_drc_runset_format(path) Validator->>Validator: read file content alt content matches patterns Validator-->>DRCConfig: valid else content invalid Validator-->>DRCConfig: ValidationError end DRCConfig-->>DRCRunner: validated config DRCRunner->>KLayout: execute DRC with runset KLayout-->>DRCRunner: results DRCRunner-->>User: DRCResults