kicad monkey v2026.11.30
On This Page (5)

Rust Workspace Overview

Alongside its Python library, kicad-monkey ships a standalone, pure-Rust workspace built for deterministic speed, zero-copy source indexing, and embeddable tooling — with no KiCad desktop installation, no Python interpreter, and no OpenCASCADE (OCCT) runtime required.


Why Pure Rust Alongside Python?

Python (kicad-monkey + kcr) excels at interactive hardware scripting, spreadsheet generation, and rapid prototyping. When you need tight memory ceilings, deterministic multi-board CI throughput, or a native library you can embed directly into a Rust service, desktop app, or WASM target, the Rust workspace gives you first-class native access to the exact same KiCad formats:

note

Rust Library Crates vs. Native k3 CLI Binary: This section (and the auto-generated rustdoc Crate API) documents the six pure-Rust library and codegen crates built directly from the public wavenumber-eng/kicad_monkey Cargo workspace. The standalone native k3 CLI executable (kicad-cruncher-cli, which additionally embeds the Geometer 3D client for STEP HLR) is documented in the Native Rust CLI (k3) Parity Guide.


Workspace Crate Dependency DAG

Each crate owns a clean, acyclic slice of the stack so downstream Rust tools compile only what they need (for example, a contract consumer or text shaper never pulls in fabrication geometry or SVG serialization):

text
  cad-text-realization   (Newstroke vector fonts + HarfBuzz/Skrifa OpenType shaping & outlines)
         │
         ├──▶ kicad-monkey-contracts  (TypeSpec-generated strict serde DTOs; ZERO schemars runtime)
         │           │
         ▼           ▼
       kicad-monkey-core   (S-expr lexer/parser/patcher, PCB/Footprint/Sch/Sym/Project views,
         │                  hierarchical compilation, Plotter IR, authoring)
         │
         ├──▶ kicad-monkey-fab   (whole-nm FabViewData, 17 virtual layers, Gerber/Drill/IPC-2581/
         │                        SVG/PnP/BOM/Micro-STEP, board & footprint vdoc baking)
         │
         └──▶ kicad-monkey-svg   (direct typed SVG rendering for boards, footprints, symbols,
                                  and schematic pages — consumes contracts + core)

  kicad-monkey-codegen   (standalone dev/build binary: Draft 2020-12 JSON Schema -> Rust via
                          schemars + typify + syn + prettyplease; no runtime link into apps)

Adding Crates to Your Project

All six workspace crates currently set publish = false while crates.io publication is prepared separately. Consume them via a Cargo git dependency pinned to a tag/commit or a local path checkout:

toml
[dependencies]
# Option 1: Git dependency (pin to a release tag or commit rev)
kicad-monkey-core = { git = "https://github.com/wavenumber-eng/kicad_monkey", tag = "v2026.11.30" }
kicad-monkey-fab  = { git = "https://github.com/wavenumber-eng/kicad_monkey", tag = "v2026.11.30" }
kicad-monkey-svg  = { git = "https://github.com/wavenumber-eng/kicad_monkey", tag = "v2026.11.30" }

# Option 2: Local workspace / vendor checkout
# kicad-monkey-core = { path = "../kicad_monkey/src/rs/kicad-monkey-core" }
# kicad-monkey-fab  = { path = "../kicad_monkey/src/rs/kicad-monkey-fab" }

Building, Testing & Local rustdoc

sh
# Format, lint, and test every crate in the workspace
cargo fmt --all -- --check
cargo clippy --workspace --all-targets --locked
cargo test --workspace --locked

# Generate and open full rustdoc API documentation
RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --workspace --open

Explore the Rust Docs

kicad-monkey v2026.11.30·Docs updated 2026.12.01 15:43 UTC (fd9b75b)