kiutils-rs 0.1.3

Pure-Rust KiCad API for seamless, lossless S-expression document round-trips
Documentation

kiutils-rs

Pure-Rust, lossless KiCad S-expression document API for agent workflows. Designed for parse -> typed edit -> write with minimal diff noise and explicit forward-compat surfaces.

Why this crate (for AI agents and automation)

Capability kiutils-rs Python kiutils KicadModTree KiCad IPC Rust API (kicad-api-rs-official)
File round-trip target First-class (WriteMode::Lossless) SCM-friendly goal, with known round-trip caveats in docs Generator-centric (creates footprints; not general file parser API) Runtime IPC API (different problem)
Unknown/future syntax Exposed as typed unknown carriers (UnknownNode, UnknownField) Known issues document format/ordering caveats in some cases Focused on scripted footprint construction N/A for S-expression file editing
Architecture for tooling 3 layers (kiutils-sexpr -> kiutils-kicad -> kiutils-rs) Single Python package/dataclass stack Tree-based node generator framework IPC client binding
Public tests/docs signal Integration tests assert byte-equal lossless writes across formats Project tests exist; changelog tracks format fixes over time README/docs emphasize footprint generation workflows README states docs are not yet available

Source evidence:

V1 API scope

  • .kicad_pcb
  • .kicad_mod
  • fp-lib-table
  • sym-lib-table
  • .kicad_dru
  • .kicad_pro

Compatibility target:

  • Primary: KiCad v10
  • Secondary: KiCad v9

Quickstart

use kiutils_rs::{PcbFile, WriteMode};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut doc = PcbFile::read("input.kicad_pcb")?;
    doc.set_generator("kiutils-rs-agent")
        .set_generator_version("0.1.0")
        .upsert_property("Owner", "EDA-Agent");
    doc.write_mode("output.kicad_pcb", WriteMode::Lossless)?;
    Ok(())
}

Crate package name: kiutils-rs Rust import path: kiutils_rs