Ryan Malloy c905032a39 Fix DSN tokenizer to accept KiCad net names like /*52
Specctra's SpecCharASCII includes / and *, and an Identifier may start with /,
so KiCad emits hierarchical net names such as /*52 and /53. The tokenizer
treated any /* as a block-comment start and raised 'unterminated comment' when
no */ followed — rejecting real KiCad DSN. Match FreeRouting's JFlex rule-order
resolution: /* is a comment only when a closing */ exists; otherwise it is an
ordinary name run. Validated against a KiCad 10.0.4 pcbnew-exported DSN (78 nets
incl. /*52, /53).
2026-07-11 18:46:29 -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%