Ryan Malloy 3bf4f6bed2 Implement Specctra DSN parser with typed board model
Ports the read path of FreeRouting's io/specctra/parser package to a
Java-free Python implementation:

- tokenizer: S-expression lexer mirroring SpecctraFileDescription.flex
  (comments, quoted strings, the string_quote IGNORE_QUOTE directive,
  case-insensitive keywords, and hash-prefixed names)
- sexp: nested S-expression tree builder
- shapes: rect/circle/polygon/path plus area-with-holes scopes
- model: typed dataclasses for layers, padstacks, images, placements,
  nets, net classes, rules, keepouts
- reader: recursive-descent scope readers producing a DsnBoard, one
  _read_* function per FreeRouting read_scope method

46 pytest cases cover the tokenizer, tree, shapes, and end-to-end
parsing against hand-crafted fixtures modeled on FreeRouting's own
test DSN files. Parses 90 of 91 upstream fixtures (the one failure is
a binary OLE file, not text DSN).
2026-07-11 15:21:18 -06:00

freeroute

A native Python PCB autorouter — a Java-free port of the FreeRouting engine.

Why

kicad-mcp currently autoroutes by shelling out to freerouting.jar, which drags in a JVM dependency. freeroute reimplements the routing engine in pure Python so the toolchain needs no Java at all.

The contract

The entire integration surface is two Specctra files:

board.dsn  ──▶  freeroute  ──▶  board.ses
(unrouted)                       (routed session: traces + vias)

kicad-cli already exports .dsn and imports .ses, so freeroute is a drop-in replacement for the JAR step — nothing else in the pipeline changes.

Status

Pre-alpha. Under active development. See docs/PORTING_PLAN.md for the architecture and porting roadmap.

Usage (target)

freeroute board.dsn -o board.ses

Development

uv sync
uv run pytest
uv run ruff check src/ tests/

License

GPL-3.0-or-later, matching the FreeRouting source it is ported from.

Description
Native Python PCB autorouter — a Java-free port of the FreeRouting engine (Specctra DSN in, SES out)
Readme GPL-3.0 391 KiB
Languages
Python 100%