Run a DRC rule deck against a GDSII or OASIS layout file and report violations
as structured data. By default (--engine curated), runs fully headless via
KLayout's native Region check primitives — no GUI, no Qt, no standalone
klayout binary. --engine klayout opts into shelling out to a standalone
klayout binary to run a PDK-native DRC-DSL deck instead (issue #565).

positional arguments:
  file|request path to a GDSII or OASIS layout file, OR a `klt drc` request document (issue #1867): a path to a JSON file, '-' to read the request from stdin, or an inline JSON object string. The two forms share this slot and are told apart by value shape, never by position -- '-', a value starting with '{', or a file whose first non- whitespace byte is '{' is a request document; anything else is a layout path. A request document is mutually exclusive with this command's own flags (--deck/--top/--engine/--deck-file/--deck- var/--pdk/--pdk-root/--timeout-s/--rules), which it carries as fields instead -- see docs/cli/drc.md, 'Request document'. Omit when using --check (the input path is read from the committed report instead; give it alongside --check to override that recorded path, issue #2699) or --list-rules/--list-rule-categories (no layout is read)

options:
  -h, --help show this help message and exit
  --deck DECK DRC deck to run (currently: gf180mcu, sg13cmos5l, sg13g2, sky130). Required for --engine curated (the default); ignored for --engine klayout. ASAP7 DRC is a KLayout script, not a curated deck: run it with --engine klayout --deck-file src/klayout_tools/decks/asap7.drc (docs/cli/drc.md, 'ASAP7 deck'). Not validated by argparse -- an unknown deck name exits 1 with a clean error, per docs/cli/drc.md's exit-code contract, rather than argparse's usage-error exit 2.
  --top TOP top cell to check when the stream has more than one; omit to check every top cell. With --engine klayout, a stream with several top cells requires --top (the deck runs against that cell's subtree only).
  --engine {curated,klayout,both} 'both' (issue #3973): run the curated deck (--deck) and the PDK-native deck on the same layout and report where they differ; an unavailable native run is not_checked, never clean. 'curated' (default): klt's own pip-only Region-primitive deck (--deck required). 'klayout' (issue #565, opt-in): shells out to a standalone klayout binary on PATH to run a PDK-native DRC-DSL script (.lydrc/.drc), resolved via --pdk/--pdk-root or given directly via --deck-file. See docs/cli/drc.md, 'Engine'.
  --deck-file DECK_FILE explicit path to a KLayout DRC-DSL script (.lydrc/.drc) to run with --engine klayout, overriding --pdk/--pdk-root resolution
  --pdk PDK PDK variant (e.g. sky130A); resolves the native deck for --engine klayout, and, for either engine, is recorded in provenance.pdk (issue #1901) when given. Overrides $PDK
  --pdk-root PDK_ROOT explicit PDK install root; overrides $PDK_ROOT and the search order
  --timeout-s TIMEOUT_S wall-clock budget in seconds for the klayout subprocess (--engine klayout only)
  --deck-var NAME=VALUE extra '-rd NAME=VALUE' script global to pass to the klayout subprocess, beyond the always-set 'input'/'report' (--engine klayout only; ignored for --engine curated). Repeatable -- pass once per variable. Some PDK-native decks gate every rule behind additional globals (FEOL/BEOL enable flags, a metal- stack selector, etc.) their PDK's own run wrapper would normally set; without this, such a deck silently checks nothing and still reports a clean, empty report. Not needed for a self-contained deck (e.g. sky130A's sky130A.lydrc). See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --allow-deck-errors accept a partial report from a deck run that klayout itself reported an error for (--engine klayout only; ignored for --engine curated). By default a non-zero klayout exit status or an ERROR line in its output fails the run even when a report file exists (issue #1941), since a deck that calls report(...) early and then aborts leaves a partial report behind whose zero violations are not a clean verdict. Use this only when you have deliberately scoped around a known-unrunnable rule; the tolerated exit status and ERROR lines are recorded in the report's own engine_deck_errors field. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --min-klayout-version VERSION minimum standalone KLayout application version (e.g. 0.30.12) the native deck needs (--engine klayout only; ignored for --engine curated). The `klayout` on PATH is probed with -v before the deck runs; an older, missing or unparseable version fails up front. Omitted: no check. Not bypassed by --allow-deck- errors/--allow-missing-host-tools, and passing does not prove the deck is compatible. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --klayout-binary PATH standalone KLayout application to run the native deck with (--engine klayout/both only). Precedence: this flag, then $KLT_KLAYOUT_BINARY, then `klayout` on PATH. A named but non-runnable binary is an error, never a PATH fallback. Lets a throwaway pinned env supply a newer KLayout than the distro one. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --negative-control LAYOUT known-bad fixture layout the same deck must flag (curated and klayout engines): run first with identical options (waivers not applied); zero violations fails the run (error.code negative_control_failed), proving the deck executed. See docs/cli/drc.md, 'Negative control'.
  --negative-control-categories NAMES comma-separated rule categories the --negative-control fixture must additionally produce (requires --negative-control).
  --expect-rule-categories N opt-in coverage assertion (--engine klayout only; ignored for --engine curated): vouch that the deck declares exactly N unique RDB rule categories (positive integer). A mismatch fails the run naming both counts; an exact match with zero findings is reported as clean (exit 0) instead of coverage_unknown (exit 4), and the assertion is recorded in the report's coverage_assertion field. Never satisfied by a run that tolerated deck errors (--allow-deck- errors). A count cannot tell a swapped category from a match; prefer --expect-rule-categories-file. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --expect-rule-categories-file PATH opt-in exact-set coverage assertion (--engine klayout only; ignored for --engine curated; mutually exclusive with --expect-rule-categories): a UTF-8 file naming, one per line, exactly the RDB rule categories the deck must declare (surrounding whitespace trimmed, blank lines ignored, duplicates merged, case-sensitive; no comments or globs). Any missing or unexpected name fails the run listing both -- even when the counts agree; an exact match is graded like a satisfied --expect-rule-categories and recorded in the report's coverage_assertion field. The list must be reviewed independently for this deck revision, its switches and inputs: copying the accepted run's own categories is circular, and categories declared inside data- dependent branches can vary with the layout. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --allow-missing-host-tools skip the host preflight that refuses to run a deck script shelling out to a command missing from PATH (--engine klayout only; ignored for --engine curated). By default such a deck fails up front naming the utility (issue #2333), because a PDK driver's host assumptions -- e.g. a logger that shells out to procps pmap(1) -- abort the deck before any rule runs, with a downstream error that names something else entirely. Use this when the shell-out is on a branch your run never takes. See docs/cli/drc.md, 'Engine' -> 'klayout'.
  --check REPORT verify a previously committed 'klt drc --format json' report (REPORT) instead of running a fresh check (issue #1106). The input layout is read from REPORT itself unless the positional 'file' is also given, which then overrides REPORT's recorded input unconditionally (issue #2699: needed when REPORT's input is outside any repository). Cheap mode (default): re-hash the input layout and deck named in REPORT's provenance block and compare against the recorded content_hash values, no DRC engine re-run. Combine with --rerun for full mode (re-run the deck and diff verdict-bearing fields). Exits 0 if still consistent, 3 if drifted -- see docs/cli/drc.md, '-- check'
  --rerun full mode for --check (issue #1106): re-run the DRC deck named in REPORT and diff verdict-bearing fields against the committed report, excluding provenance.klt_version/klayout_version/pdk.version (fields that legitimately vary between runs of identical inputs). Requires --check; a clean error (exit 1) otherwise
  --list-rules list the curated --deck's registered rules (id, description, check kind, layers, scope) and their total count instead of running DRC: no layout is read and the output is not a DRC verdict. Requires --deck; not supported with --engine klayout -- a PDK-native deck has no curated rule registry, so use --list-rule- categories for it. See docs/cli/drc.md, 'Rule listing and selection'
  --list-rule-categories --engine klayout only (issue #5444): list the rule categories the native deck declares, instead of running DRC on a layout. The deck is run under the given --deck-var set against a tool-generated EMPTY layout, so the set is independent of any layout being signed off -- unlike copying an accepted run's own coverage.rule_categories, which is circular. --format text prints exactly the names, one per line, so stdout redirects straight into an --expect-rule-categories- file manifest (notes go to stderr). Categories a deck declares only inside a geometry-dependent branch are NOT listed; see the payload's `limitations`. Fails closed (exit 1) if the deck does not complete or declares nothing. Takes only --deck/--deck- file/--pdk/--pdk-root/--deck- var/--timeout-s/--klayout-binary/--min-klayout- version/--allow-missing-host-tools. See docs/cli/drc.md, 'Rule listing and selection'
  --rules ID[,ID...] run only these curated deck rules (issue #2768): comma-separated exact rule ids and/or case-sensitive shell-style globs over ids -- quote globs, e.g. --rules 'met1.*,via.width.1'. Whitespace is trimmed; empty or unmatched tokens are an error. Unselected rules are not executed; a proper subset is reported as partial (status clean_partial when clean) and recorded in the report's rule_selection block, so it never counts as full DRC signoff. Not supported with --engine klayout or --check (--check --rerun replays a report's recorded selection)
  --waivers PATH rule-scoped cell waivers (issue #3483, --engine curated only): a JSON file {"waivers": [{"cell": ..., "rule": <id|glob>, "justification": ...}]}. Markers whose source_cell and rule match move out of violations/violation_count/status into a separate waived array (with waiver_justification), never dropped silently; the file is pinned in provenance.waivers. See docs/cli/drc.md, 'Waivers'
  -o, --output PATH also write the report envelope to PATH, byte-identical to `--format json` stdout, whether the run is clean or exits 3 on violations; gzip-compressed (deterministic) when PATH ends `.gz`. Stdout and exit codes are unchanged (issue #4393). Not supported with --check or --list-rules. See docs/cli/drc.md
  --tile COLSxROWS abutment context (issue #4226, --engine curated only): check each top cell as the centre of a COLSxROWS array of itself at its prBoundary (else bbox) pitch, e.g. 3x1; counts must be odd. Only markers in the centre instance are reported, so a boundary-cut tileable cell is judged among its neighbours. See docs/cli/drc.md, 'Abutment context'
  --max-violations N issue #4464, --engine klayout only: serialize at most N entries in `violations[]` (first N in the report's sort order); 0 = summary-only. `violation_count`, `rule_counts` and `status` keep the true totals and `violations_truncated` marks a capped report. Default: unlimited. See docs/cli/drc.md
  --format {text,json} output format (default: text)
